内存泄漏,每次代码一样,这个是在控件里面,在退出时会出现,不知道错误在何处,请各位提示一下该如何来做?
Detected memory leaks!
Dumping objects ->
{74} normal block at 0x015F1090, 64 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{73} normal block at 0x015F1100, 276 bytes long.
Data: < w w v w> CD CD CD CD 00 00 D1 77 00 00 DA 77 1B 76 DA 77
Object dump complete.
Detected memory leaks!
Dumping objects ->
{74} normal block at 0x015F1090, 64 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{73} normal block at 0x015F1100, 276 bytes long.
Data: < w w v w> CD CD CD CD 00 00 D1 77 00 00 DA 77 1B 76 DA 77
Object dump complete.
方法2、屏蔽一些代码,来确定泄露位置
方法3、使用一些API和工具
#ifdef _DEBUG
#define DEBUG_CLIENTBLOCK new( _CLIENT_BLOCK, __FILE__, __LINE__)
#else
#define DEBUG_CLIENTBLOCK
#endif
#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>
#ifdef _DEBUG
#define new DEBUG_CLIENTBLOCK
#endif然后在入口函数处调用
_CrtDumpMemoryLeaks();
2、gdi
3、导入资源或者对象没有释放
这个很简单的,我给你举个简单的例子:
1.假如你有个atl生成的com activex,你在stdafx.h中加入宏
2.在控件类的的dllmain中,或者,干脆在控件类的构造函数中调用宏_CrtDumpMemoryLeaks();
3.使用的时候,如果创建了控件对象,停止调试时output就提示了。可定位到文件。
直接用安装一个BoundsChecker
就可以搞定了。其它的方法都比较繁琐
看看有没有对应的delete
可是这个问题,我觉得不太好办
我不知道留在这里不太好,我也不确定到底是我的代码里面的问题呢,还是用到IJL库的问题
不过问题还是没有解决,期待各位高手给进一步的提示
谢谢!--------------------------------------------
No memory leaks detected.
Visual Leak Detector is now exiting.
Detected memory leaks!
Dumping objects ->
{88} normal block at 0x01A52FB0, 64 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{87} normal block at 0x01A52B20, 276 bytes long.
Data: < w wRx w> CD CD CD CD 00 00 D1 77 00 00 DA 77 52 78 DA 77
Object dump complete.