c++中檢測內存泄漏可以引入系統定義的宏來查看,內存在哪個位置泄漏
文件開始處加入下列定義
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
程序退出時加入以下函數:
_CrtDumpMemoryLeaks();
如果有泄漏會顯示
e:\myproject\mltithrd.14\mltithrd.cpp(95) : {68} client block at 0x00372550, subtype c0, 144 bytes long.
a CMultiDocTemplate object at $00372550, 144 bytes long
posted on 2005-10-27 15:49
Ipedo 閱讀(6151)
評論(4) 編輯 收藏 引用