VisualC++ debugger 和 CRT 库
第一步: 包含以下头文件
#define _CRTDBG_MAP_ALLOC
#include <stdlib>
#include <crtdbg.h>
第二步: 接管 new 操作符
#ifdef _DEBUG
#ifndef DBG_NEW
#define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ ,__LINE__)
#define new DBG_NEW
#endif
#endif
第三步: 在代码结束出输出内存泄漏信息
_CrtDumpMemoryLeaks();
内存泄漏工具:
Windows : Purify,BoundsCheaker、Deleaker、VisualLeak Detector(VLD), Linux 平台:Valgrind memcheck
5721

被折叠的 条评论
为什么被折叠?



