实验第三方的内存泄露检测工具VLD(Visual Leak Detector)
来源:互联网 发布:淘宝电子面单打印软件 编辑:程序博客网 时间:2024/06/02 04:03
[ 转载请注明来自CoderJeff的CSDN博客:http://blog.csdn.net/coderjeff/article/details/46474955,谢谢!]
VLD版本:2.2.3
VLD的安装目录:C:\Program Files (x86)\Visual Leak Detector
C++编译器:visual studio 2013
实验代码:
#include "stdafx.h"
#include <new>
#include <vld.h>
void func()
{
int *p = new int; //第46行
}
int _tmain(int argc, _TCHAR* argv[])
{
int *p = new int[4]; //第56行
func();
return 0;
}
按照官方网站上的说法,在vs工程中设置好VLD的include和lib路径,包含上<vld.h>头文件,一切就绪,运行程序,但却接连出现错误。
1. 提示找不到vld_x86.dll文件。
解决方法:从VLD目录下,找到该文件,拷贝到程序的执行目录下。
2. 又提示”应用程序无法正常启动(0xc0150002)“。
解决方法:参考文章中的方法,在VLD目录中,找到Microsoft.DTfW.DHL.manifest,拷贝到程序的执行目录下。
3.又提示缺文件”dbghelp.dll“。
解决方法:在VLD目录中,找到该文件,拷贝到程序的执行目录下。
4.都没问题了,但运行结果却说没有检测到内存泄露:
Visual Leak Detector Version 2.2.3 installed.
No memory leaks detected.
Visual Leak Detector is now exiting.
在这个链接里找到了答案:在vs2013中确实不好使,只适用于vs2008/2010/2012。
解决方法:用VLD的新版本v2.4rc2
卸载掉2.2.3,在同一个位置安装2.4rc2,注意安装的时候会提示你先关闭vs。
别急着打开vs运行程序,否则,还会提示没有检测到内存泄露,控制台依然显示是2.2.3。需要把新版本的dbghelp.dll,vld_x86.dll,Microsoft.DTfW.DHL.manifest这三个文件拷贝到程序的执行目录下。
终于成功了!
下面是按F5后在output中的结果:
Leak Hash: 0x32782EB5, Count: 1, Total 16 bytes
Call Stack (TID 11420):
0x0F8DC260 (File and line number not available): MSVCR120D.dll!operator new
f:\dd\vctools\crt\crtw32\stdcpp\newaop.cpp (6): ConsoleApplication3.exe!operator new[] + 0x9 bytes
d:\programs\consoleapplication3\consoleapplication3\consoleapplication3.cpp (56): ConsoleApplication3.exe!wmain + 0x7 bytes
f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c (623): ConsoleApplication3.exe!__tmainCRTStartup + 0x19 bytes
f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c (466): ConsoleApplication3.exe!wmainCRTStartup
0x76CB337A (File and line number not available): kernel32.dll!BaseThreadInitThunk + 0x12 bytes
0x773292E2 (File and line number not available): ntdll.dll!RtlInitializeExceptionChain + 0x63 bytes
0x773292B5 (File and line number not available): ntdll.dll!RtlInitializeExceptionChain + 0x36 bytes
Data:
CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD ........ ........
---------- Block 2 at 0x00550A70: 4 bytes ----------
Leak Hash: 0x5B08DF93, Count: 1, Total 4 bytes
Call Stack (TID 11420):
0x0F8DC260 (File and line number not available): MSVCR120D.dll!operator new
d:\programs\consoleapplication3\consoleapplication3\consoleapplication3.cpp (46): ConsoleApplication3.exe!func + 0x7 bytes
d:\programs\consoleapplication3\consoleapplication3\consoleapplication3.cpp (59): ConsoleApplication3.exe!wmain
f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c (623): ConsoleApplication3.exe!__tmainCRTStartup + 0x19 bytes
f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c (466): ConsoleApplication3.exe!wmainCRTStartup
0x76CB337A (File and line number not available): kernel32.dll!BaseThreadInitThunk + 0x12 bytes
0x773292E2 (File and line number not available): ntdll.dll!RtlInitializeExceptionChain + 0x63 bytes
0x773292B5 (File and line number not available): ntdll.dll!RtlInitializeExceptionChain + 0x36 bytes
Data:
CD CD CD CD ........ ........
Visual Leak Detector detected 2 memory leaks (92 bytes).
Largest number used: 92 bytes.
Total allocations: 92 bytes.
Visual Leak Detector is now exiting.
The program '[11552] ConsoleApplication3.exe' has exited with code 0 (0x0).
- 实验第三方的内存泄露检测工具VLD(Visual Leak Detector)
- vld(Visual Leak Detector 内存泄露检测工具
- vld(Visual Leak Detector) 内存泄露检测工具
- 内存泄漏检测工具--Visual Leak Detector (VLD)
- vld内存泄漏检测工具--Visual Leak Detector (VLD)
- 内存泄露检测工具 -- Visual Leak Detector
- 内存泄露检测工具 -- Visual Leak Detector (转)
- 内存泄露检测工具 Visual Leak Detector
- 内存泄露检测工具Using Visual Leak Detector
- C++内存泄露检测工具Visual Leak Detector的使用
- 关于内存泄漏检测工具VLD(Visual Leak Detector)
- 使用vld(visual leak detector)进行内存泄露调试
- *vc中检测内存泄露的工具VLD(visual leak detector) 转
- vc中检测内存泄露的工具VLD(visual leak detector) 转
- vc中检测内存泄露的工具VLD(visual leak detector)
- vc6.0内存泄露之检测工具Visual Leak Detector
- Visual C++的免费的内存泄露检测工具-Visual Leak Detector
- VC好用简单的内存泄露检测工具 Visual Leak Detector
- Eclipse maven 配置 第三方maven插件
- Android---Handling Runtime Changes
- Java中的final
- Struts学习笔记之快速上手
- 排列组合 求一个字符串的排列
- 实验第三方的内存泄露检测工具VLD(Visual Leak Detector)
- Java接口、抽象类、继承
- 奇异值分解SVD在简单推荐系统中的应用
- 解决 input密码框自动填充
- shell编程中 read export echo 理解
- 【JavaScript】单击网页任意一处打开新窗口与关闭窗口
- IP Address
- UML简单介绍(十六)——类图的两个基本案例分析
- 虚拟机运行win95