c++中檢測(cè)內(nèi)存泄漏可以引入系統(tǒng)定義的宏來查看,內(nèi)存在哪個(gè)位置泄漏
文件開始處加入下列定義
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
程序退出時(shí)加入以下函數(shù):
_CrtDumpMemoryLeaks();
如果有泄漏會(huì)顯示
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)
評(píng)論(4) 編輯 收藏 引用