delete 错用 delete[] 导致 Trigger Point Break
在_DEBUG模式中, delete 最后会调用函数:
- extern "C" void __cdecl _free_dbg_nolock(
- void * pUserData,
- int nBlockUse
- )
该函数位于dbgheap.c , 而delete[]也调用这个函数.
在该函数中,有一个检查函数:
- /*
- * If this ASSERT fails, a bad pointer has been passed in. It may be
- * totally bogus, or it may have been allocated from another heap.
- * The pointer MUST come from the 'local' heap.
- */
- _ASSERTE(_CrtIsValidHeapPointer(pUserData));
这里会形成一个Trigger Point