#ifndef _MEMORY_CHECK_H_ #define _MEMORY_CHECK_H_ #ifdef WIN32 #pragma warning(disable:4786) #endif #include void *dmalloc(const char *file, int line, size_t size); void dfree(const char *file, int line, void *ptr); void* operator new (size_t size); void* operator new (size_t size, char const * file, int line); void* operator new (size_t size, char const * file, int line, char const *func); void* operator new[] (size_t size); void* operator new[] (size_t size, char const * file, int line); void* operator new[] (size_t size, char const * file, int line, char const *func); void operator delete (void * ptr); void operator delete[] (void * ptr); struct MemoryPosition{ void *ptr; char position[256]; }; class MemoryPositionList{ private: bool MallocatedMemoryChecked; std::list mlist; public: MemoryPositionList(bool=false); ~MemoryPositionList(); //add item to list void Add(MemoryPosition*); //remove item from the list void Remove(void*); private: //print all memory leaks void Dump(); }; #endif //_MEMORY_CHECK_H_