I saw people searching for mpatrol in this list. If leakage detection is
the main objective, I think my leakage detector is worth a try.
For the impatient, this is the link to the download, which includes the
source code and documentation in HTML and PostScript:
A not up-to-date (though newly written) article discussing my leakage
detector is here (and I'll update the page for new features in the next
The new version has special support for gcc/binutils, and I have tested
it on both MinGW and Linux. Now one does NOT have to include debug_new.h
to print the file/line information of leak positions. For this simple
char* p = new char;
// delete p;
Build it with:
g++ -g test_new.cpp debug_new.cpp -D_DEBUG_NEW_PROGNAME="""a.exe"""
The result will be:
Leaked object at 00482C98 (size 100, C:/TEMP/test_new.cpp:3)
Uncomment the fourth line and try again, the result will be:
delete after new: pointer 00482C98 (size 100)
originally allocated at C:/TEMP/test_new.cpp:3
abnormal program termination
(I don't think mpatrol can detect this mismatch of new/delete.)
Debug_new only slows down the memory (de)allocation routines a little,
by about 30%. My tests show that mpatrol is about 800 times slower than
debug_new on Linux, and about 500 times slower on Windows (with MinGW).
Some discussions about it can be found in the newsgroup
comp.lang.c++.moderated, under the topic "An Article about a
Cross-Platform Memory Leak Detector".