I have a fairly complicated application that stops working after 2-3 days of continuous run. The place where it stops is always the same: the _heap_alloc_dbg function in the DBGHEAP.C file. We run the Debug version because we suspect another bug in the code that brings the Release version down after a much longer period of running.
The small Message Box tells me that "User breakpoint called from code at 0x10212ad0".
The code for this function is:
void * __cdecl _heap_alloc_dbg(
const char * szFileName,
int fIgnore = FALSE;
_CrtMemBlockHeader * pHead;
/* verify heap before allocation */
if (_crtDbgFlag & _CRTDBG_CHECK_ALWAYS_DF)
lRequest = _lRequestCurr;
/* break into debugger at specific memory allocation */
if (lRequest == _crtBreakAlloc)
// here is the place were the app stops
// ... function continuous
Because both lRequest and _crtBreakAlloc are -1, the _CrtDbgBreak() is called and brings that small Message Box.
Looking at the context, I can see that everything happens during a static allocation for the same type. This is a complex type that embeds other complex types. The last constructor that brings me to the _heap_alloc_dbg belongs to a type that has a member that is defined as
std::list<_component_type *> _lstStoredList;
I have the feeling that the framework uses the wrong allocation routines and this causes all the trouble.
At this time I really don’t know what else to try. Any suggestions would be greatly appreciated.