Homebrew Check memory leaks and debuging in 3ds development

antoniorand

New Member
OP
Newbie
Joined
Oct 7, 2021
Messages
3
Trophies
0
Age
24
XP
22
Country
Spain
Hello, I'm developing a graphic engine for my college thesis, a library for the 3ds so everyone can build 3d games.

But I'm starting coding and I have to make sure first of these:

- How to check if there's a memory leak while running the application.

- If there's a memory leak, how can I debug it.

It would be really helpful since I don't want to brick my console or something.

Thanks in advance
 

laramie

Well-Known Member
Member
Joined
Dec 15, 2014
Messages
911
Trophies
0
XP
1,365
Country
United States
Hello, I'm developing a graphic engine for my college thesis, a library for the 3ds so everyone can build 3d games.

But I'm starting coding and I have to make sure first of these:

- How to check if there's a memory leak while running the application.

- If there's a memory leak, how can I debug it.

It would be really helpful since I don't want to brick my console or something.

Thanks in advance
luma3ds has a debugging option but I don't know if it also works on old 3ds's, my new 2ds xl has the option so depends on what hardware you are targeting.
 

antoniorand

New Member
OP
Newbie
Joined
Oct 7, 2021
Messages
3
Trophies
0
Age
24
XP
22
Country
Spain
luma3ds has a debugging option but I don't know if it also works on old 3ds's, my new 2ds xl has the option so depends on what hardware you are targeting.
Must say my target machine is a New 2ds xl so that will be really helpful too.
 

laramie

Well-Known Member
Member
Joined
Dec 15, 2014
Messages
911
Trophies
0
XP
1,365
Country
United States
Must say my target machine is a New 2ds xl so that will be really helpful too.
yeah if you'd like to do both you can but you'd need to make two functions to determine different console types then just sort memory features accordingly. Hope that helps :P
 

ghjfdtg

Well-Known Member
Member
Joined
Jul 13, 2014
Messages
1,035
Trophies
0
XP
2,483
Country
You can detect memory leaks by overriding malloc() and free() via the linker options "-Wl,--wrap=malloc,--wrap=free". Then make the functions "__wrap_malloc()" and "__wrap_free()". You can then hook every memory allocation/deallocation with these 2 functions and track if everything is getting free'd on exit.

Oh and the real malloc() and free() functions can be accessed by calling "__real_malloc()" and "__real_free()".
 

antoniorand

New Member
OP
Newbie
Joined
Oct 7, 2021
Messages
3
Trophies
0
Age
24
XP
22
Country
Spain
You can detect memory leaks by overriding malloc() and free() via the linker options "-Wl,--wrap=malloc,--wrap=free". Then make the functions "__wrap_malloc()" and "__wrap_free()". You can then hook every memory allocation/deallocation with these 2 functions and track if everything is getting free'd on exit.

Oh and the real malloc() and free() functions can be accessed by calling "__real_malloc()" and "__real_free()".
woah that's actually REAAAALLY helpful, now I'm not actually not scared of breaking anything
 

You may also like...

General chit-chat
Help Users
  • No one is chatting at the moment.
  • Psionic Roshambo @ Psionic Roshambo:
    Does come with some of his product? Lol
    +1
  • K3N1 @ K3N1:
    It's already scented so your dogg can have a high time
    +1
  • K3N1 @ K3N1:
    Damn Lenovo still hasn't shipped my Xbox
    +1
  • M4x1mumReZ @ M4x1mumReZ:
    Lenovo ships Xboxes?! I though Microsoft does that.
  • K3N1 @ K3N1:
    You do realize other companies ship consoles right
    +1
  • M4x1mumReZ @ M4x1mumReZ:
    Correct. To other redistributors.
  • M4x1mumReZ @ M4x1mumReZ:
    Didn't know that Lenovo sells them also.
  • K3N1 @ K3N1:
    Lenovo is a redistributer
    +1
  • M4x1mumReZ @ M4x1mumReZ:
    Nice to know that
  • K3N1 @ K3N1:
    Cheapest I found $230 tax/s&h
    +1
  • K3N1 @ K3N1:
    Sihuuu Taco Holder Stand set of 2 - Holds up to 3 tacos in each Taco Tray - Sturdy, Dishwasher and Microwave Safe https://a.co/d/6FFlct5 What kind of tacos are even in those racks
  • Veho @ Veho:
    What's that, ham and cheese?
  • Veho @ Veho:
    I often stick some ham and cheese in a tortilla and toast it but I wouldn't dare call it a taco.
  • K3N1 @ K3N1:
    I guess ice cream in a taco is still a taco
  • K3N1 @ K3N1:
    The product placement in the fantasy football movie is werid it starts out with a psp then goes to the series x
  • Veho @ Veho:
    There's a fantasy football movie?
  • K3N1 @ K3N1:
    I bet you can't believe it's about Madden
  • Veho @ Veho:
    I can't believe it's not butter.
  • K3N1 @ K3N1:
    Lebron James did help produce it so it can't be that shit right
  • cearp @ cearp:
    kennie'snewname is now the old name???
    +1
  • M4x1mumReZ @ M4x1mumReZ:
    Woah! Kenny has changed their name?
  • M4x1mumReZ @ M4x1mumReZ:
    @cearp, Hey there!
    M4x1mumReZ @ M4x1mumReZ: @cearp, Hey there!