Made memory management optional

This commit is contained in:
David Anderson 2004-09-07 06:11:17 +00:00
parent baef3362ed
commit 3d0e25a8ef
2 changed files with 7 additions and 0 deletions

View File

@ -2681,6 +2681,8 @@ void ValidateMacros_DontCallThis_Smiley()
}
#endif
#ifdef MEMORY_TEST
/************* MEMORY *************/
// undef all defined macros
#undef new
@ -2852,6 +2854,8 @@ void operator delete[](void *reportedAddress)
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress);
}
#endif //MEMORY_TEST
/************* stuff from dlls/util.cpp *************/
// must come here because cbase.h declares it's own operator new

View File

@ -2122,6 +2122,8 @@ void MF_Log(const char *fmt, ...);
#define MF_UnregisterSPForward g_fn_UnregisterSPForward
#define MF_GetPlayerFlags g_fn_GetPlayerFlags
#ifdef MEMORY_TEST
/*** Memory ***/
void *operator new(size_t reportedSize);
void *operator new[](size_t reportedSize);
@ -2165,5 +2167,6 @@ void Mem_Deallocator(const char *sourceFile, const unsigned int sourceLine, cons
#define realloc(ptr,sz) Mem_Reallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_realloc,sz,ptr)
#define free(ptr) Mem_Deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
#endif //MEMORY_TEST
#endif // #ifndef __AMXXMODULE_H__