C/C++ dynamic memory validation and tracking - finding leaks and overwites.C/C++ dynamic memory validation and tracking - finding leaks and overwites. admin 28 February, 2010 - 15:30
Simple set of modules that will help to find leaks and overwrites in a C/C++ based program.
It's a mini version of something like BoundsChecker.
I originally wrote it for use in C, so it doesn't handle the cosmetic side of things so well in C++.
Still it is probably the most useful thing, in terms of debugging aids, that
I've ever written, finding numerous bugs by its vigilance.
What it does is to provide replacements for the standard C runtime
allocation routines. The replacements track all allocations, provide
error notification when your program does something naughty.
Currently it will tell you:
- When freeing non-allocated memory
- When you overwite past the beginning or end of an allocated glock
- How much memory is in use
- Where the memory is being used (which modules & lines)
It aids finding of leaks, by having a function which will dump memory
usage to a file, so you can do this before and after an operation and compare
the two files and the difference will highlight any potential leaks.
Also, when you free memory it fills all free'd & delete'd blocks with
0xfe to prevent possible usage after free, and you will not be able to