Fixed memory allocation

This commit is contained in:
David Anderson 2004-09-12 00:14:34 +00:00
parent f2faf990a0
commit ac59f75523
2 changed files with 4 additions and 12 deletions

View File

@ -2689,8 +2689,6 @@ void ValidateMacros_DontCallThis_Smiley()
}
#endif
#ifdef MEMORY_TEST
/************* MEMORY *************/
// undef all defined macros
#undef new
@ -2804,7 +2802,7 @@ void *operator new(size_t reportedSize)
return ptr;
// allocation failed
throw std::bad_alloc();
}
void *operator new[](size_t reportedSize)
@ -2817,7 +2815,7 @@ void *operator new[](size_t reportedSize)
return ptr;
// allocation failed
throw std::bad_alloc();
}
// Microsoft memory tracking operators
@ -2831,7 +2829,7 @@ void *operator new(size_t reportedSize, const char *sourceFile, int sourceLine)
return ptr;
// allocation failed
throw std::bad_alloc();
}
void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine)
{
@ -2843,7 +2841,7 @@ void *operator new[](size_t reportedSize, const char *sourceFile, int sourceLine
return ptr;
// allocation failed
throw std::bad_alloc();
}
void operator delete(void *reportedAddress)
@ -2862,8 +2860,6 @@ void operator delete[](void *reportedAddress)
Mem_Deallocator(g_Mem_CurrentFilename, g_Mem_CurrentLine, g_Mem_CurrentFunc, m_alloc_delete_array, reportedAddress);
}
#endif
/************* stuff from dlls/util.cpp *************/
// must come here because cbase.h declares it's own operator new

View File

@ -2122,8 +2122,6 @@ 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);
@ -2167,6 +2165,4 @@ 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__