1、下载vlc
2、创建应用并配置
c/c++ -> General -> Additional Include Directories = C:\Program Files (x86)\Visual Leak Detector\include
Linker -> General -> Additional Library Directories = C:\Program Files (x86)\Visual Leak Detector\lib\Win32
3、捕捉内在泄露
输入如下:
Visual Leak Detector Version 2.2.3 installed.
WARNING: Visual Leak Detector detected memory leaks!
Call Stack:
c:\users\enost_000\desktop\consoleapplication1\consoleapplication1\consoleapplication1.cpp (13): ConsoleApplication1.exe!wmain + 0xD bytes
f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c (533): ConsoleApplication1.exe!__tmainCRTStartup + 0x19 bytes
f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c (377): ConsoleApplication1.exe!wmainCRTStartup
0x74EE8543 (File and line number not available): KERNEL32.DLL!BaseThreadInitThunk + 0xE bytes
0x770EAC69 (File and line number not available): ntdll.dll!RtlInitializeExceptionChain + 0x85 bytes
0x770EAC3C (File and line number not available): ntdll.dll!RtlInitializeExceptionChain + 0x58 bytes
Data:
CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD ........ ........
CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD ........ ........
CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD ........ ........
CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD ........ ........
CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD ........ ........
CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD ........ ........
CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD ........ ........
CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD ........ ........
CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD ........ ........
CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD ........ ........
CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD ........ ........
CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD ........ ........
CD CD CD CD CD CD CD CD ........ ........
Visual Leak Detector detected 2 memory leaks (372 bytes).
Largest number used: 372 bytes.
Total allocations: 372 bytes.
Visual Leak Detector is now exiting.
The program '[0x262C] ConsoleApplication1.exe' has exited with code 0 (0x0).
4、qt也vlc
vlc只支持vc编译器,所以 qt的话只能够使用vc编译器捕捉并解决内存泄露之后,再考虑使用mingw(gcc/g++)编译程序。
Original: https://www.cnblogs.com/chuncn/archive/2012/12/05/2803450.html
Author: chuncn
Title: 使用Visual Leak Detector for Visual C++ 捕捉内存泄露
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/536523/
转载文章受原作者版权保护。转载请注明原作者出处!