Visual Leak Detector 2.2.3 Visual C++内存检测工具
来源:互联网 发布:计算机初级程序员考试 编辑:程序博客网 时间:2024/06/05 11:37
Visual Leak Detector是一款免费的、健全的、开源的Visual C++内存泄露检测系统。相比Visual C++自带的内存检测机制,Visual Leak Detector可以显示导致内存泄露的完整内存分配调用堆栈。
主页地址:http://vld.codeplex.com/
旧版地址:http://www.codeproject.com/Articles/9815/Visual-Leak-Detector-Enhanced-Memory-Leak-Detectio
下载Visual Leak Detector,当前版本2.2.3,在Visual C++ IDE的"工具"→"选项"→"项目和解决方案"→"VC++ 目录","包含文件"增加VLD的"\include"路径,"库文件"增加VLD的"\lib\Win32"路径,另外动态库"\bin\Win32"路径在安装时已经添加到环境变量里面了,若是未添加,则需要手动拷贝"\bin\Win32"下的文件到工程Debug目录。下面记录下使用方法:
1.新建一个Win32控制台项目;
2.添加代码如下所示:
1
2
3
4
5
6
7
8
#include "stdafx.h"
#include "vld.h"
int _tmain(int argc, _TCHAR* argv[])
{
char *pBuf = new char[200];
return 0;
}
2
3
4
5
6
7
8
#include "vld.h"
int _tmain(int argc, _TCHAR* argv[])
{
char *pBuf = new char[200];
return 0;
}
3.在Debug模式下的“输出”窗口,将有如下信息:
报告列出了内存泄露是在第几块,所在的地址,泄露的字节,调用的堆栈,内存内容。双击调用堆栈可以跳转到所在行。
4.在Release模式下,不会链接Visual Leak Detector。
5.Visual Leak Detector有一些配置项,可以设置内存泄露报告的保存地(文件、调试器),拷贝"\Visual Leak Detector"路径下的vld.ini文件到工程的Debug目录下(在IDE运行的话,则需要拷贝到工程目录下),修改以下项:
ReportFile = .\memory_leak_report.txt
ReportTo = both
ReportTo = both
直接双击Debug目录下exe,结果如下图所示:
文件内容跟“输出”窗口的内容一样。
- C/C++ 内存检测工具Visual Leak Detector
- Visual Leak Detector 2.2.3 Visual C++内存检测工具
- Visual Leak Detector 2.2.3 Visual C++内存检测工具
- Visual Leak Detector 2.2.3 Visual C++内存检测工具
- Visual Leak Detector 2.2.3 Visual C++内存检测工具
- Visual Leak Detector 2.2.3 Visual C++内存检测工具(转载)
- 【转】Visual Leak Detector 2.2.3 Visual C++内存检测工具
- Visual Leak Detector 2.2.3 Visual C++内存检测工具
- Visual Leak Detector 2.2.3 Visual C++内存检测工具
- C/C++ 内存泄漏检测工具 Visual Leak Detector(转载)
- C/C++ 内存泄漏检测工具 Visual Leak Detector
- 内存泄露检测工具 -- Visual Leak Detector
- 内存泄露检测工具 -- Visual Leak Detector (转)
- 内存泄漏检测工具--Visual Leak Detector (VLD)
- 内存泄露检测工具 Visual Leak Detector
- 内存泄漏检测工具Visual Leak Detector
- VC2012内存泄漏检测工具Visual Leak Detector
- 内存泄露检测工具Using Visual Leak Detector
- 树形控件的使用
- tabhost 垂直布局
- PL SQL下通过语句查看表或者视图结构
- 经典:从追MM谈Java的23种设计模式
- MySQL 的并集、交集和差集
- Visual Leak Detector 2.2.3 Visual C++内存检测工具
- 头文件的编写
- mysql 根据字段名查找该字段属于哪个表
- 使用 Struts 2 开发 RESTful 服务
- 在jsp中修改了编码方式出现了乱码怎么办
- 找出调用DBLINK的SESSION信息
- dom4j实战(一)——使用dom4j从XML中读取数据源配置
- Adobe Reader10添加书签
- dom4j实战(二)——使用dom4j设计Openfire式导航菜单