2006/12/20 | 内存泄露检测工具 -- Visual Leak Detector
类别(学习) | 评论(0) | 阅读(2897) | 发表于 11:45

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.

提供下载:

点击下载该文件
0

评论Comments

日志分类
首页[122]
图片[31]
文字[29]
日志[38]
学习[11]
收藏[13]