I continue to encounter this error "Debug assertions failed!"when running my program in debug mode. I tried to find this error on the C ++ visual website, but the explanations are too advanced for me, and they bear no resemblance to my best guess about the problem.
I looked at my code and narrowed down the point at which the error occurs. This seems to be happening in that part of the code where I manually delete the whole bunch of heap arrays before the computer moves to the next part of the program. When I comment on a section that frees old heap arrays, the program works fine.
Any idea what is going on here? My programming knowledge is still relatively basic.
thank
I am using Visual C ++ 2008.
Additional Information:
The breakpoint is triggered in this block of code:
void operator delete(
void *pUserData
)
{
_CrtMemBlockHeader * pHead;
RTCCALLBACK(_RTC_Free_hook, (pUserData, 0));
if (pUserData == NULL)
return;
_mlock(_HEAP_LOCK);
__TRY
pHead = pHdr(pUserData);
_ASSERTE(_BLOCK_TYPE_IS_VALID(pHead->nBlockUse));
_free_dbg( pUserData, pHead->nBlockUse );
__FINALLY
_munlock(_HEAP_LOCK);
__END_TRY_FINALLY
return;
}
This code is in the tab: dbgdel.cpp
The section of my code that I “narrowed down” that causes this problem is this:
delete [] topQuadanglesPositions;
delete [] fourClamps;
delete [] precaculatedClamp1;
delete [] precaculatedClamp2;
delete [] precaculatedClamp3;
delete [] precaculatedClamp4;
delete [] area;
delete [] hullConfiguration;
delete [] output;
delete [] prunedListClamp1;
delete [] prunedListClamp2;
delete [] prunedListClamp3;
delete [] prunedListClamp4;
delete [] numValidLocations;
If I comment on this section, the program works fine.
Faken source
share