C++ rtmp livestream 流媒体

海阔天空 张翼飞翔

我的学习笔记。--我喜欢这里,因为这里安静,无广告骚扰。
随笔 - 82, 文章 - 2, 评论 - 126, 引用 - 0
数据加载中……

内存泄露检测Visual Leak Detector

1.0版本的使用方法:
        解压后得到vld.h、vldapi.h、vld.lib、vldmt.lib、vldmtdll.lib、dbghelp.dll等文件,把这些所有.h头文件拷贝到VC默认的include目录下,将所有.lib文件拷贝到VC默认的lib目录下,安装工作就完成了。
        使用VLD只须在包含入口函数的CPP或C文件中把vld.h头文件包含进来即可。该include语句要求放在最前面,如果当前工程定义预编译head文件(如stdafx.h),则放在“#include <stdafx.h>”语句之后就可以了。之后正常编译、按Debug方式运行被测程序,等程序运行结束时,查阅VC的output窗口,会有“Visual Leak Detector is now exiting.”一句打印信息,在这条件信息之前,如果当前程序没有内存泄露会有“No memory leaks detected.”信息打印。
1.9版本必须先安装 再和1.0版本的一样使用

翻译:
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:

Copy the VLD library (*.lib) files to your Visual C++ installation's "lib" subdirectory.
Copy the VLD header files (vld.h and vldapi.h) to your Visual C++ installation's "include" subdirectory.
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.
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.
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.


posted on 2008-03-27 12:06 ZhangEF 阅读(851) 评论(0)  编辑  收藏 所属分类: C/C++