Add Dirk Luetjen's ssphys libraries and command-line tool
[vss2svn.git] / ssphys / utils / LeakWatcher.h
blob5325df0cf36531866e9dd7fb71064b6b9cc89344
1 //---------------------------------------------------------------------------
2 // LeakWatcher.h
4 #ifndef IMWATCHINGYOULEAK
5 #define IMWATCHINGYOULEAK
7 #include <crtdbg.h>
9 #ifdef _DEBUG
10 inline void* operator new(size_t nSize, const char * lpszFileName, int nLine)
12 return ::operator new(nSize, 1, lpszFileName, nLine);
14 #define DEBUG_NEW new(THIS_FILE, __LINE__)
16 inline void operator delete(void* pMem, const char* pszFilename, int nLine)
18 ::operator delete(pMem);
21 #define MALLOC_DBG(x) _malloc_dbg(x, 1, THIS_FILE, __LINE__);
22 #define malloc(x) MALLOC_DBG(x)
24 #endif // _DEBUG
26 #endif // #include guard