首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

VS2010应用Visual Leak Detector检测内存泄漏 没用作用

2012-08-17 
VS2010使用Visual Leak Detector检测内存泄漏 没用作用根据网上介绍的Visual Leak Detector安装方法下载了

VS2010使用Visual Leak Detector检测内存泄漏 没用作用
根据网上介绍的Visual Leak Detector安装方法下载了个Visual Leak Detector 1.9d version 安装好了 分别把vld.lib vld.h vld.dll等拷到对应的目录
测试网上的代码

C/C++ code
    #include<vld.h>         #include<stdlib.h>         #include<stdio.h>         void f()         {              int *p = newint(0x12345678);               printf("p=%08x, ", p);          }         void main()        {            f();         }


结果output窗口显示
Visual Leak Detector Version 1.9d installed.
“Ex3.exe”: 已加载“C:\Windows\System32\imm32.dll”,Cannot find or open the PDB file
“Ex3.exe”: 已加载“C:\Windows\System32\msctf.dll”,Cannot find or open the PDB file
“Ex3.exe”: 已加载“ImageAtBase0x4ac60000”,“包括”/“排除”设置禁用了加载功能。
“Ex3.exe”: 已卸载“ImageAtBase0x4ac60000”
线程 'Win32 线程' (0x17b0) 已退出,返回值为 0 (0x0)。
No memory leaks detected.
程序“[4472] Ex3.exe: 本机”已退出,返回值为 0 (0x0)。


不知道是怎么回事?是不是 “包括”/“排除”设置禁用了加载功能。 这里有关系 也看不懂

[解决办法]
要保证是Debug版。
[解决办法]
这类工具不能尽信
不过你这么短的DEMO测试有问题应该是使用的问题
[解决办法]
WARNING: Visual Leak Detector detected memory leaks!
---------- Block 58 at 0x003C3440: 4 bytes ----------
Call Stack:
f:\dd\vctools\crt_bld\self_x86\crt\src\dbgmalloc.c (56): malloc
f:\code\csdn\csdn\s.cpp (11): f
f:\code\csdn\csdn\s.cpp (23): main
f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c (582): __tmainCRTStartup
f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c (399): mainCRTStartup
0x7C816FD7 (File and line number not available): RegisterWaitForInputIdle
Data:
78 56 34 12 xV4..... ........

Visual Leak Detector detected 1 memory leak.
[解决办法]
debug模式
在 int *p = newint(0x12345678);这行后面下断点
F5 然后再F5就可以看到泄露了
只不过我比较习惯用1.1
[解决办法]
是不是debug版编译?
[解决办法]
debug编译
这些工具也不能检测100%的问题
[解决办法]
用express可以的。。
[解决办法]
要记得在output窗口中右击,然后把“程序输出”标记上

热点排行