1
0
forked from 0ad/0ad

Added a function to enable excessively slow memory debugging, for detecting heap corruption close to where it happens.

This was SVN commit r792.
This commit is contained in:
Ykkrosh 2004-07-21 12:28:23 +00:00
parent f171a2faf0
commit 1343de75d8
2 changed files with 14 additions and 0 deletions

View File

@ -316,6 +316,11 @@ static inline void pre_main_init()
// (w)sdl will take care of it anyway.
}
// Warning: This makes things rather slow.
void memory_debug_extreme_turbo_plus()
{
_CrtSetDbgFlag( _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_DELAY_FREE_MEM_DF );
}
extern u64 rdtsc();
extern u64 PREVTSC;

View File

@ -946,6 +946,15 @@ if(!g_MapFile)
}
}
// Check for heap corruption after every allocation. Very, very slowly.
// (And it highlights the allocation just after the one you care about,
// so you need to run it again and tell it to break on the one before.)
/*
extern void memory_debug_extreme_turbo_plus();
memory_debug_extreme_turbo_plus();
_CrtSetBreakAlloc(36367);
//*/
// Initialize entities
CMessage init_msg (CMessage::EMSG_INIT);