Homebrew Check memory leaks and debuging in 3ds development

antoniorand

New Member
OP
Newbie
Joined
Oct 7, 2021
Messages
3
Trophies
0
Age
26
XP
42
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,387
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
26
XP
42
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,387
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,360
Trophies
1
XP
3,282
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
26
XP
42
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
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Xdqwerty @ Xdqwerty: @salazarcosplay, gta v is down since november 2021