Identify Memory Leaks in Visual CPP Applications —— VLD内存泄漏检测工具
原文地址:http://www.codeproject.com/Articles/1045847/Identify-Memory-Leaks-in-Visual-CPP-Applications
基于CPOL License
Visual Leak Detector (VLD) is an easy to use memory leak detection system. The installation package can be downloaded from here.
After installation, it can be used with any C/C++ project simply by adding the following line to the code:
#include <vld.h>
When the program is executed under the Visual Studio debugger, Visual Leak Detector will output a memory leak report of the executed segment of the code, at the end of the debugging session. If memory leaks are detected, this report will point to the exact locations in the code segment, which allocated the leaked memory block.
The header file can be easily isolated from the rest of the source codes by guarding it with the pre-processor directive block. It can be made further user friendly by defining a separate Visual Studio build configuration for VLD. The steps are as follows:
- Include VLD header files(s) protected by a pre-processor directive.
Hide Copy Code
#ifdef _VLD_DEBUG
#include <vld.h> //For memory leak detection.
#endif //_VLD_DEBUG - Create a VLD specific Build Configuration for development purposes. Detailed steps to create a Build Configuration are available here.
- Under the new Build Configuration (example
VLD_Debug
), define the pre-processor directive which enables VLD specific headers.- Right click on the project on Visual Studio Solution Explorer & select Properties. This will open the Property Page of the project.
- Expand the Configuration Properties node.
- Expand C\C++ node.
- Select Preprocessor. Enter preprocessor definition (example. "
_VLD_DEBUG
"). - Add the location of the vld.h header file to "includes" directory path of this configuration.
- Select VLD specific Build Configuration for development purposes.
References
License
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
Identify Memory Leaks in Visual CPP Applications —— VLD内存泄漏检测工具的更多相关文章
- Cocos开发中性能优化工具介绍之Visual Studio内存泄漏检测工具——Visual Leak Detector
那么在Windows下有什么好的内存泄漏检测工具呢?微软提供Visual Studio开发工具本身没有什么太好的内存泄漏检测功能,我们可以使用第三方工具Visual Leak Detector(以下简 ...
- 内存泄漏检测工具VLD在VS2010中的使用举例
Visual LeakDetector(VLD)是一款用于Visual C++的免费的内存泄露检测工具.它的特点有:(1).它是免费开源的,采用LGPL协议:(2).它可以得到内存泄露点的调用堆栈,可 ...
- 【Visual Studio】简单内存泄漏检测方法 解决 Detected memory leaks! 问题(转)
原文转自 http://blog.csdn.net/u011430225/article/details/47840647 我的环境是: XP SP2.VS2003 最近在一个项目中, 程序退出后都出 ...
- 在VS2017中配置VLD(Visual Leak Detector)内存泄漏检测工具
首先在官方下载VLD 下载地址: https://kinddragon.github.io/vld/ 此版本为V2.5.1,为最后发布版本,下载后安装.加入你的安装路径为:VLD_Path,后面会用到 ...
- Cocos性能优化工具的开发介绍Visual Studio内存泄漏检测工具——Visual Leak Detector
然后,Windows下有什么好的内存泄漏检測工具呢?微软提供Visual Studio开发工具本身没有什么太好的内存泄漏检測功能.我们能够使用第三方工具Visual Leak Detector(下面简 ...
- vld(Visual Leak Detector) 内存泄露检测工具
初识Visual Leak Detector 灵活自由是C/C++语言的一大特色,而这也为C/C++程序员出了一个难题.当程序越来越复 杂时,内存的管理也会变得越加复杂,稍有不慎就会出现内存问题.内存 ...
- 【转】简单内存泄漏检测方法 解决 Detected memory leaks! 问题
我的环境是: XP SP2 . VS2003 最近在一个项目中,程序退出后都出现内存泄漏: Detected memory leaks! Dumping objects -> {98500} n ...
- _CrtSetBreakAlloc简单内存泄漏检测方法,解决Detected memory leaks!问题
我的环境是: XP SP2 . VS2003 最近在一个项目中,程序退出后都出现内存泄漏: Detected memory leaks! Dumping objects -> {98500} n ...
- vld,Bounds Checker,memwatch,mtrace,valgrind,debug_new几种内存泄露检测工具的比较,Valgrind Cheatsheet
概述 内存泄漏(memory leak)指由于疏忽或错误造成程序未能释放已经不再使用的内存的情况,在大型的.复杂的应用程序中,内存泄漏是常见的问题.当以前分配的一片内存不再需要使用或无法访问时,但是却 ...
随机推荐
- PHP表单header post get
header 是服务器以HTTP协议到浏览器前所送出的字符串 在表头与HTML文件之间需要空出一行 $_POST $_GET 必须要有method="post" 上传文件类表单 ...
- Linux 的文本处理命令一览
grep 基于关键字搜索文本内容 -i 搜索时忽略大小写-n 显示结果所在行数-v 输出不带关键字的行-Ax 在输出的时候包含结果所在行之后的指定行数(x为一个数值,表示输出后面x行)-Bx 在输出的 ...
- 附加类型的实体失败,因为相同类型的其他实体已具有相同的主键值。在使用 "Attach" 方法或者将实体的状态设置为 "Unchanged" 或 "Modified" 时如果图形中的任何实体具有冲突键值
var list= DAL.LoadEntities(x => x.OrderCode == orderCode).AsNoTracking().ToList().FirstOrDefault( ...
- 设置DataSource后DateGridView不显示的问题
在一个WinForm小程序中,有两处需要用DataGridView控件显示数据.设置DataGridView.DataSource为数据查询结果后,第一个DataGridView可以正常显示数据,而第 ...
- 首页自动生成静态化html
由于平台老是出现间歇性502.排查发现,php死进程过多耗费大量系统资源. 除了优化代码之外,静态化可以减少php进程.缓解一下服务器压力. 把首页生成html后,出现问题频率下降.所以需要做首页静态 ...
- SPSS数据分析—广义估计方程
广义线性模型虽然很大程度上拓展了线性模型的应用范围,但是其还是有一些限制条件的,比如因变量要求独立,如果碰到重复测 量数据这种因变量不独立的情况,广义线性模型就不再适用了,此时我们需要使用的是广义估计 ...
- Gerald's Hexagon
Gerald's Hexagon Gerald got a very curious hexagon for his birthday. The boy found out that all the ...
- 数据类型、常量、变量、printf、scanf和运算符
数据类型 常量 变量 printf函数介绍 scanf函数介绍 运算符 数据类型 数据类型是指数据在内存中存储的方式. C语言中有5大数据类型:基本类型.构造类型.指针类型.空类型.定义类型. C语言 ...
- jquery 实现 返回顶部
//Html代码: <div class="backToTop" title="返回顶部">返回顶部</div> //代码 //CS ...
- XML 详解
import urllib import requests from xml.etree import ElementTree as ET root = ET.XML(open('D:\E\seman ...