Hierarchical Edge Bundle 1.0
|
00001 #pragma once 00002 00003 #if defined(_MSC_VER) && defined(WIN32) && defined(_DEBUG) 00004 #define USE_MEMORY_TRACKING 00005 #endif 00006 00007 #ifdef USE_MEMORY_TRACKING 00008 #include <crtdbg.h> 00009 #include <windows.h> 00010 00011 #define DEBUG_CLIENTBLOCK new( _CLIENT_BLOCK, __FILE__, __LINE__) 00012 #define new DEBUG_CLIENTBLOCK 00013 00014 extern _CrtMemState mem_state; 00015 00016 #define SET_CRT_DEBUG_FIELD(a) \ 00017 _CrtSetDbgFlag((a) | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)) 00018 00019 inline void DebugDumpMemory() 00020 { 00021 _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG); 00022 _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG); 00023 _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG); 00024 } 00025 00026 inline void InitMemoryTracker() 00027 { 00028 SET_CRT_DEBUG_FIELD(_CRTDBG_LEAK_CHECK_DF); 00029 00030 _CrtMemCheckpoint(&mem_state); 00031 00032 #ifdef _DEBUG 00033 atexit(DebugDumpMemory); 00034 #endif 00035 } 00036 #else // USE_MEMORY_TRACKING 00037 #define DEBUG_CLIENTBLOCK 00038 inline void gxDbgDumpMem() {} 00039 inline void gxInitDebug() {} 00040 #endif // USE_MEMORY_TRACKING