no swim no life

Debug Assertion Failted! (_CrtlsValidHeapPointer(pUserData)) 본문

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.

'work > error' 카테고리의 다른 글

Some VS2005 and VS2008 Wizards Pop Up Script Error.  (0) 2010.07.05
MFC / Cannot add new member  (0) 2009.05.20
not in formal parameter list  (0) 2009.03.24
Comments