work/error
Debug Assertion Failted! (_CrtlsValidHeapPointer(pUserData))
달려간다
2009. 6. 12. 05:38
DLL 내부(B.dll)에서 선언한 메모리를 어플리케이션(A.exe)에서 해지하려 할 때 발생.
서로 다른 메모리 할당 규칙( Z != X )을 사용할 수 있는, A와 B 사이에 메모리 할당/해지가 발생했을 경우
Debug 모드라면 할당 규칙에 대한 검사 중 프로그램이 종료 될 것이다. (아래 코드)
/*
* 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));
위의 코드 내부에 다음 위치
return HeapValidate( _crtheap, 0, pHdr(pUserData) );
위의 체크가 생략되는 release 모드에서는 Z와 X가 같은 방식의 힙 관리를 사용할 경우 정상 동작 할 수 있다.
(동일한 시스템에서 작성되었다면 정상 동작할 확률이 높다.)
에러 알림 다이얼로그
Debug Assertion Failted!
Program: ...
File: dbgheap.c
Line: 1044
Expression: _CrtlsValidHeapPointer(pUserData)
For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts.