00001 00002 // NOTE! This file shall be included _only_ in the translation unit which 00003 // defines main to check the allocations in test programs. Still this does 00004 // not always work, but you typically get an idea if there is a memory leak 00005 // in new/delete. BETTER: Use MORE_NEW and MORE_DELETE from more/debug.h 00006 // explicitely for the part of the program to check. 00007 00008 #ifndef MORE_CHECKMEM_H 00009 #define MORE_CHECKMEM_H 00010 00011 #include <more/diag/debug.h> 00012 00013 inline void* operator new(std::size_t sz) throw(std::bad_alloc) { 00014 return more::diag::checkmem::alloc(sz); 00015 } 00016 00017 inline void operator delete(void* ptr) throw() { 00018 more::diag::checkmem::free(ptr); 00019 } 00020 00021 #endif