VC好用简单的内存泄露检测工具 Visual Leak Detector

VC好用简单的内存泄露检测工具 Visual Leak Detector 收藏

<script type="text/javascript"> document.body.oncopy = function() { if (window.clipboardData) { setTimeout(function() { var text = clipboardData.getData("text"); if (text && text.length > 300) { text = text + "/r/n/n本文来自CSDN博客,转载请标明出处:" + location.href; clipboardData.setData("text", text); } }, 100); } } </script>

这 几天对一些老程序进行检查,发现部分程序都有内存泄露的现象.经过查找比较发现Visual Leak Detector是一个很好用的内存检测工具 .用这个工具只需要在主运行文件加一句 #include "vld.h"即可,调试时会将内存泄露的情况输出到调式输出窗口中.该工具可将内存泄露的情况定位到语句上(可能不会100%准确有效).

以下是使用方法:(英文较简单,不在翻译)

Using Visual Leak Detector

This section briefly describes the basics of using Visual Leak Detector (VLD). If your project contains DLLs that you'd like to also check for memory leaks, please see Detecting Leaks in DLLs.

To use VLD with your project, follow these simple steps:

  1. Copy the VLD library (*.lib ) files to your Visual C++ installation's "lib" subdirectory.
  2. Copy the VLD header files (vld.h and vldapi.h ) to your Visual C++ installation's "include" subdirectory.
  3. In the source file containing your program's main entry point, include the vld.h header file. It's best, but not absolutely required, to include this header before any other header files, except for stdafx.h . If the source file includes stdafx.h , then vld.h should be included after it.
  4. If you are running Windows 2000 or earlier, then you will need to copy dbghelp.dll to the directory where the executable being debugged resides.
  5. Build the debug version of your project.

VLD will detect memory leaks in your program whenever you run the debug version under the Visual C++ debugger. A report of all the memory leaks detected will be displayed in the debugger's output window when your program exits. Double-clicking on a source file's line number in the memory leak report will take you to that file and line in the editor window, allowing easy navigation of the code path leading up to the allocation that resulted in a memory leak.

Note: When you build release versions of your program, VLD will not be linked into the executable. So it is safe to leave vld.h included in your source files when doing release builds. Doing so will not result in any performance degradation or any other undesirable overhead.

资源文件下载:

http://dl2.csdn.net/down4/20070726/26150843748.zip

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值