메모리 누수 체크
2020. 8. 13. 15:33ㆍ프로그래밍/Note
#ifdef _DEBUG
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#ifndef DBG_NEW
#define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ )
#define new DBG_NEW
#endif
#endif // _DEBUG
// 초기에 한번만 실행
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
위 코드를 심어두면 메모리 누수 발생 시 출력창에 위와 같이 뜬다.
'프로그래밍 > Note' 카테고리의 다른 글
개발자 면접 시 짚고 넘어가야 할 질문들 (0) | 2021.11.05 |
---|---|
Blocking-NonBlocking-Synchronous-Asynchronous (0) | 2020.08.12 |
Analysis of Platformers (0) | 2020.07.12 |
구글 C++ 스타일 가이드 (feat. 전방선언) (0) | 2020.07.10 |
코드 읽기 (0) | 2020.06.30 |