Is there a way detect memory leaks without going through the code and look for them? Some technic, or maybe a developer tool?
Thank you.
Printable View
Is there a way detect memory leaks without going through the code and look for them? Some technic, or maybe a developer tool?
Thank you.
Something I have done is overload new and delete.
Arrange it such that the new new/delete log where they were called from and what they were asked to do.
Examine the logs, look for unpaired calls for example.
Depending on OS, there are other approaches, but that works at the language level.
so in other words to track on a code level the allocating ?
Here is a link to a garbage collection library for C and C++. I'm not sure how well it works though since I've never tried it. ;)
i'm not looking to replace the functions but to track them without too much trouble :D
There are also API function with handles and objects that should also be closed or freed...
You can also wrap API functions in logging wrappers if you need to.
Memory leaks are usually either bad design work, or poor implementation of a good design. Whenever I have been asked to find a stubborn memory leak, it has almost always been sloppy coding, not anything esoteric or weird.
Well, i'm talking about slappy coding... because we are all human after all :(
Can you please explain alittle more about the logging wrapers, and how do I do it?