Use of the memory leak detection tool Visual Leak Detector for VC ++

Source: Internet
Author: User

Visual Leak Detector (VLD). The downloaded version is 1.9d. It supports vc6, vc7 (2003), and vc8 (2005). It is open-source and can be compiled based on the source code, 64-bit machines can compile 64-bit machines by themselves. However, in my machine (64-bit CPU, 64-bit windows7), 74-bit is not compiled separately.


VLD is only valid for the debug version of the program and does not work for the release version. Therefore, you can use VLD in a released version regardless of the Code introduction.


: Http://www.codeproject.com/articles/9815/visual-leak-detector-enhanced-memory-leak-detectio;


Usage:

Take vs2005 as an example. The tool --- option --- project and solution --- VC ++ directory: ① contains file: Add Directory, which is the include folder under the installation directory, and move the directory to the last library file in the list: add the Directory, which is the Lib folder under the installation directory, and also move to the last one. ③ Add the header file # include "VLD. H ", it should be noted that the header file should be placed after all pre-compiled header files, such as stdafx. H and so on, you can also put the pre-compiled header file stdafx. h, and introduce the pre-compiled header file in the source file, the VLD. h can be introduced in multiple source files or common header files, for example, in. H and B. VLD is introduced in H. h. Multiple source files introduce. H and B. h, there is only one VLD in the process. H code, without any side effects (only for version 1.9d, other versions are unknown ).


In addition, the parameter meanings under VLD. ini in the installation directory and the details including but not limited to the content mentioned in this article are described in readme in the installation directory.


VLD also provides several simple APIs for users to use, as shown below:

Void vlddisable (void); // disable Memory leakage detection

Void vldenable (void); // valid for Memory leakage detection

Eg.

Content in the output window:


Support for other vs versions: Search for visual leak detector in the external program manager of vs2010 and find the plug-in. The description of this plug-in is for vs2008/2010/2012. Therefore, if you use these versions of Vs, you can try this method.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.