1 #include "mem3dc.h" 2 3 #if DBGMALLOC 4 5 #if 1 6 7 // try and turn C++ new/delete tracking on such that 8 // we can do a malloc dump when the global objects 9 // with associated memory allocated is recored, the 10 // deallocation is recored, and then a malloc dump 11 // is done 12 13 // note that some global objects wont have their memory 14 // allocations/deallocations in the constructor/destructor 15 // tracked through record_malloc/record_free, but since 16 // global objects are deconstructed in the reverse order 17 // from construction, the deallocation type in the destructor 18 // will correspond to the allocation type in the constructor 19 20 int __cpp_new_recording = 0; 21 22 class DebugObject 23 { 24 public: 25 DebugObject(); 26 ~DebugObject(); 27 }; 28 DebugObject()29DebugObject::DebugObject() 30 { 31 __cpp_new_recording = 1; 32 } 33 ~DebugObject()34DebugObject::~DebugObject() 35 { 36 __cpp_new_recording = 0; 37 DumpMallocInfo(DUMPTOFILE); 38 } 39 40 static DebugObject dbo; 41 42 #else 43 44 int __cpp_new_recording = 1; 45 46 #endif 47 48 #endif 49