VLD 1.0 ReadMe translation attempt, vld1.0readme Translation

Source: Internet
Author: User

VLD 1.0 ReadMe translation attempt, vld1.0readme Translation

I want to learn about the implementation of VLD in the near future. I plan to start with the simplest V1.0 version. Below is a self-translated version of V1.0. The latest 2.x version seems to be much more powerful.

 

Introduction

Visual C ++ provides a built-in memory detection mechanism, but at best it only meets the minimum positioning requirements. The VLD tool is positioned as an alternative to built-in memory leakage and provides the following features:

  • Full call stack backtracking of memory blocks leaked, including files and their row numbers;
  • Full Memory leakage dump (hex and ascii format );
  • Customizable leak report levels (configurable details)

 

Compared with the Purify and BoundsChecher tools, they are free of charge, while other free tools often require intrusive code, strict use constraints, or unreliable at all. Advantages of VLD over other free tools:
  • Easy to use. You do not need to compile the source code. You only need to add several lines of code to the project to complete integration;
  • Provides the leaked memory call stack and memory dump;
  • Compatible with C \ C ++ (effective for both new/delete and malloc/free)
  • Open-source full code and good help documentation, easy to use and modify on demand for engineering adaptation;

 

 

Use VLD

If you need to check the DLL contained in the project at the same time, see "detect in DLL", steps:

VLD automatically detects Memory leakage in the debug program and prints a leak report in the output window when the program exits.Note:: When the program is compiled with the Release version, VLD will not be linked to the program. Therefore, it is safe to leave the vld. h file inclusion statement in the project source code.

 

Configuration Options

VLD has some pre-compiled macros that can control certain VLD behaviors:

VLD_AGGREGATE_DUPLICATES removes duplicate memory leaks.

VLD_MAX_TRACE_FRAMES maximum stack backtracking depth;

VLD_MAX_DATA_DUMP maximum memory dump size;

VLD_SELF_TEST: Self-diagnosis. This feature is always activated. Every time you run VLD, VLD will intentionally Leak 21 bytes of Memory and fill in the string "Memory Leak Self-Test ". This feature is used to determine whether the VLD is working.

VLD_SHOW_USELESS_FRAMES only displays useful stack information. heap and vld stacks are not displayed by default;

VLD_START_DISABLED disable auto-enable, that is, manually start VLD detection, which may cause some detection failures.

 

VLD Runtime

Void VLDDisable (void); Disable VLD;

Void VLDEnable (void); Enable VLD;

 

Detect memory leakage in DLL

Some special precautions for detecting the memory leakage in DLL to ensure the normal operation of VLD: VLD should be linked to only one module in each process. The best recommendation is the first initialized module. The details are as follows:

Implicitly loaded DLL

The implicitly loaded DLL has been initialized before the main function of the application. Therefore, dll is the first initialized module, and VLD should be linked to it. Generally, the exe program links multiple DLL files, as long as the VLD file is linked to the first module to be checked. The loading sequence of multiple DLL files can be observed in the debugger.

Explicitly loaded DLL

The LoadLibrary DLL is initialized after the exe program is initialized. At this time, the exe program should be used as a module linking the VLD;

Static link CRT DLL

When the DLL uses the/ML or/MT compiler option, multiple CRT instances exist in a process. The leakage detection of VLD cannot span the CRT boundary. A vld instance can only monitor the memory of one CRT instance. To monitor multiple CRT instances at the same time, you must connect to the VLD in each module that is statically connected to the CRT;

 

Known limitations

VLD does not support COM or other memory leakage detection unrelated to the CRT heap. To put it simply, vld1.0 only supports Memory leakage detection through new or malloc;

VLD does not support dbghelp. dll of V6.5;

The compiled VLD release package is not compatible with VS2005. If you need support, compile it in VS2005;

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.