힙에러

Code 2012. 12. 26. 03:38

멤버변수 하나 추가로 힙에러가 나기 시작


에러 메시지
"HEAP CORRUPTION DETECTED" "after Client block"
Heap block at  modified   Windows has triggered a breakpoint  This may be due to a corruption of the heap _CrtIsValidHeapPointer
This may be due to a corruption of the heap, which indicates a bug in  or any of the DLLs it has loaded
This may also be due to the user pressing F12 while


다른 프로젝트에서는 이상없음
추적결과 UINT64 변수의 근처에서 변수를 추가하거나 제거하면 에러 발생
(생성자에서 초기화 여부에 따라서도 달라짐)
메모리 정렬방식의 문제

해결
    - 프로젝트 검색 : #pragma 나 (#pragma pack)
    - #pragma pack후에 원래 설정으로 돌리지 않은 부분을 찾는다.
    - 기본값은 8, 기본값으로 돌리기 : #pragma pack()
        - #pragma pack(push, 1) 사용후, 항상 복귀 = #pragma pack(pop) 을 해준다.


참고 : http://www.winapi.co.kr/clec/cpp2/18-3-2.htm


반응형

'Code' 카테고리의 다른 글

error log-2013/01  (0) 2013.01.11
FFMPEG version up  (0) 2013.01.05
Thread 비교, 사용법  (0) 2012.12.23
error log-2012/12  (0) 2012.12.22
Visual Studio 2010 사용 관련  (2) 2012.11.17
Posted by codens