In writing C++ codes, there occur so many problems of memory leak. C++ programmers are always forced to check if they have made C++ codes correctly to prevent memory leak . Here is a good memory leak automatically detection solution named "DebugNew".
[simple_test]
#include "DebugNew.h" int main() { int* p = new int; return 0; }
At the end of execution, you can get the following output message.
$ simple_test
memory leak 00461790(4) ../simple_test.cpp:5
You can use memory leak detection module separately by calling MemoryLeak::start() and MemoryLeak::stop() case by case.
[example]
#include "DebugNew.h" void test() { printf("\ntest1\n"); MemoryLeak::start(); int* p = new int; MemoryLeak::stop(); printf("\ntest2\n"); MemoryLeak::start(); char* p2 = new char[100]; MemoryLeak::stop(); } int main() { test(); return 0; }
[result]
$ test
test1
memory leak 00601790(4) ../test.cpp:8
test2
memory leak 006035A8(100) ../test.cpp:13
[Download]
Some significant bugs fixed.
DebugNew(2011.09.16).zip (deprecated)
readme.txt added.
DebugNew(2011.09.05)_4.zip (deprecated)
Some bugs fixed. In all_test project, stl test codes added.
MemoryLeak member function names changed(clear > start, check > stop).
DebugNew(2011.09.05).zip (deprecated)
function names chcnaged. (my_malloc > debug_malloc, my_free > debug_free)
In MemoryLeak class, m_del_check variable added to check del checking.
DebugNew(2011.09.05).zip (derpecated)
[Interface]