Windows memory leak detection

My WeChat public account : CPP Advanced Tour
If you think this article is helpful to you, please pay attention to "CPP Advanced Tour" to learn more technical dry goods

1. Introduction to VLD

  VLD (Visual Leak Detector) is a free memory leak detection tool for Visual C++. Compared with other memory leak detection tools, it has the following characteristics while detecting memory leaks:

  • [1] You can get the call stack of the memory leak point, as well as the file and line number where it is located (Visual studio can directly double-click in the output debugging information to locate the memory leak location);
  • [2] You can get the complete data of the leaked memory;
  • [3] You can set the level of memory leak report;

  It is a packaged lib, no need to compile the source code when using it. For the user's own code, only minor changes are required; the source code is released under the GNU license, and there are detailed documentation and comments. It is a good choice for readers who want to learn more about heap memory management. VLD is easy to use, you only need to make small changes (add libraries, include header files), and then run your own program normally, you can use it to find memory problems. If you go deep into the source code, you can learn the principles of heap memory allocation and release, the principles of memory leak detection, and the common techniques of memory operation.
  For the higher version of VS, you can set it by configuring the project properties to prevent the specific line number of the memory leak from being unable to be located. After the installation is complete, it will automatically add its include directory to the additional installation directory of VS, and add its static library directory (lib directory) to the additional library directory of VS, without manually adding the include directory and lib directory.

Two, test code

/*
** vld官网地址:
** https://kinddragon.github.io/vld/
*/
#include <iostream>
#include <vld.h>
using namespace std;
void Func(){
    
    
    shared_ptr<int> num (new int[10]);
    //int * m_data = new int[100];
}
int main()
{
    
    
    Func();
    return 0;
}

Insert picture description here

Three, important instructions

Welcome to follow my personal WeChat public account to view professional client/server development knowledge, written interview questions, programmers’ workplace experience and experience sharing.
Insert picture description here

vld official website address: https://kinddragon.github.io/vld/
vld download address: https://download.csdn.net/download/siyacaodeai/15047978

Guess you like

Origin blog.csdn.net/siyacaodeai/article/details/113647234