Homebrew Check memory leaks and debuging in 3ds development

antoniorand

New Member
OP
Newbie
Joined
Oct 7, 2021
Messages
3
Trophies
0
Age
25
XP
32
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,377
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
25
XP
32
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,377
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,273
Trophies
1
XP
3,020
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
25
XP
32
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
  • Coravendev @ Coravendev:
    and cool username guy is outta here
  • K3N1 @ K3N1:
    Swear people have gone full on tard in my county when it comes to doing simple business tasks
  • Coravendev @ Coravendev:
    yep.
  • FlareReZ @ FlareReZ:
    @K3N1, Especially here where government makes the fucked up decisions.
  • FlareReZ @ FlareReZ:
    Can we initiate a ban on bigoted tories?
  • Coravendev @ Coravendev:
    yikes
  • K3N1 @ K3N1:
    I'd rather it be government controlled here they can franchise and make their own rules letting them do whatever the hell they want
  • Coravendev @ Coravendev:
    like who?
  • FlareReZ @ FlareReZ:
    Its sad, I know. We have Sunak who doesn't believe that biology in trans people exist. smh
  • K3N1 @ K3N1:
    Biology wise that's an entire different argument but they are people
    +1
  • FlareReZ @ FlareReZ:
    @K3N1, As long as we don't harass people of races and genders, then we can all live freely without restrictions being put upon us.
  • FlareReZ @ FlareReZ:
    @K3N1, True. You're not wrong.
  • K3N1 @ K3N1:
    I don't want to pull down my transgender shirt and have stuffed animals come out :angry:
  • K3N1 @ K3N1:
    Warn me first
  • FlareReZ @ FlareReZ:
    @K3N1, Ok, I'll stop. Chill out.
  • K3N1 @ K3N1:
    I just mean if the person is up front about it then they can be what they want to be doesn't mean I'll care any less
    +1
  • FlareReZ @ FlareReZ:
    @K3N1, That's true, Kenny. How you've said it sounds like you didn't like my point of view.
  • FlareReZ @ FlareReZ:
    You can have an opinion and I'll respect it.
  • K3N1 @ K3N1:
    People just want specific things in sexuality just how it always is
    +1
  • Coravendev @ Coravendev:
    i mean it would be nice if it were just simple.
    +1
  • K3N1 @ K3N1:
    Nah that would be boring people need others they can agree with more than disagree
    +1
    Psionic Roshambo @ Psionic Roshambo: https://youtu.be/Me7iaMuO65M?si=QYhbUovs6mee-50o