void *CDbgMemAlloc::Expand( void *pMem, size_t nSize, const char *pFileName, int nLine ) { #ifdef WIN32 GetActualDbgInfo( pFileName, nLine ); int nOldSize = GetSize( pMem ); const char *pOldFileName = GetAllocatonFileName( pMem ); int oldLine = GetAllocatonLineNumber( pMem ); RegisterDeallocation( FindOrCreateEntry( pOldFileName, oldLine ), nOldSize, 0 ); RegisterDeallocation( m_GlobalInfo, nOldSize, 0 ); m_Timer.Start(); pMem = _expand_dbg( pMem, nSize, _NORMAL_BLOCK, pFileName, nLine ); m_Timer.End(); unsigned long nTime = m_Timer.GetDuration().GetMicroseconds(); RegisterAllocation( FindOrCreateEntry( pFileName, nLine ), nSize, nTime ); RegisterAllocation( m_GlobalInfo, nSize, nTime ); #else printf("XXX: CDbgMemAlloc::Expand() not portd to FreeBSD,in file %s\n", __FILE__); abort(); #endif return pMem; }
void* _realloc(void* p, size_t size) { RegisterFree(p); void* newP = real_realloc(p ,size); RegisterAllocation(newP, size); return newP; }
void* _malloc(size_t size) { void* p = real_malloc(size); RegisterAllocation(p, size); return p; }