Hardware memory leak detection

  • Thread starter Thread starter dj_skual
  • Start date Start date
  • Views Views 1,323
  • Replies Replies 6

dj_skual

Code & Mix
Member
Joined
Mar 9, 2008
Messages
1,014
Reaction score
302
Trophies
1
Website
sourceforge.net
XP
3,036
Country
France
hello,

i'm looking about a program that can read my sources or my elf file and can report to me all memory leak in my program... i know that exist, but can't remember...

thx
 
I've never heard of a program that can do that. You have to look at the source and make sure you're freeing everything you allocate manually. A robust debugger might be able to detect that somewhat but there is only USB Gecko for the Wii/GC.
 
It's a lot different on a PC. A debugger can easily tell how much memory there is before a program runs and how much is left afterwards. The Wii doesn't have an operating system so all memory allocation and freeing is up to the app that's running.
 
An application can't do that except maybe to tell you that you're missing a call to free() or a delete keyword. It's easy to determine whether your code is leaking memory on Windows because you can stop it and inspect everything. You can do that minimally with a USB Gecko on the Wii but with just devkitPro not so much.

The best thing is to start by searching for "new" and "delete" and make sure everything you instantiate is destroyed at some point. Same with malloc/free. If you have to ask for the memory you should be giving it back. :P
 
Well, imho the best "non user friendly" memory leak detector is the exception handler where the processor halts the process currently executed due to some of the following exception cases:

undefined area access / map does not exist on target hardware

data abort / protected area access and the region permissions do not match / classic kernel map reads from usermode exception or your own exception triggered because you set the MMU properties to protect that area

bios call : the software interrupt operation used by high level OSses to force the CPU to execute asap an embedded call

so if we compare the software debugger found on several IDEs against the ones found in the hardware, they're not user friendly

cheers
 

Site & Scene News

Popular threads in this forum