vld(Visual Leak Detector) 內存泄露檢測工具,Visual C++ 2008-2015, vs 2010,vs 2008,vs 2012,vs 2015


原文: https://vld.codeplex.com/

Visual Leak Detector 是一款專用於Visual C++的內存泄漏檢測工具,它免費,開源,且魯棒性高。

VLD很容易使用:

1. 安裝完vld后,只要告訴Visual C++哪里去找到它的頭文件和庫。(下載地址:https://vld.codeplex.com

2. 然后您只要在你的c/c++工程中加上下面這一行代碼,就可以使用vld了:
#include <vld.h> 

 

您的工程在Visual Studio debug模式下運行,運行結束后,Visual Leak Detector會將內存泄漏的報告打印出來。內存泄漏報告包含完整的調用堆棧,沒釋放的內存大小。雙擊其中的調用行,可以跳轉到對應的代碼行上。

這種方式能夠高效得幫您快速診斷,修復內存泄漏問題。

CRT Debug庫和VLD主要的不同之處在於:Visual Leak Detector 完整的展示了內存泄漏的調用堆棧。

下面就是一個VLD打印的內存泄漏報告例子:

---------- Block 1199 at 0x04BE1058: 136 bytes ----------
Call Stack:
d:\Foobar\FooLog.cpp (26): FooLog::getInstance
d:\Foobar\FooMain.cpp (75): FooMain::init
f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c (578): __tmainCRTStartup
f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c (403): WinMainCRTStartup
0x759A3677 (File and line number not available): BaseThreadInitThunk
0x770C9D42 (File and line number not available): RtlInitializeExceptionChain
0x770C9D15 (File and line number not available): RtlInitializeExceptionChain
Data:
9C 33 2D 6B    74 2A 2D 6B    C8 11 BE 04    00 00 00 00     .3-kt*-k ........
00 00 00 00    70 14 BB 6C    70 14 BB 6C    00 00 00 00     ....p..l p..l....
00 00 00 00    68 14 BB 6C    68 14 BB 6C    00 00 00 00     ....h..l h..l....
00 00 00 00    6C 14 BB 6C    6C 14 BB 6C    20 12 BE 04     ....l..l l..l....
00 00 00 00    CD 00 CD CD    00 00 00 00    01 CD CD CD     ........ ........
68 14 BB 6C    78 33 2D 6B    00 00 00 00    00 00 00 00     h..lx3-k ........
00 00 00 00    01 02 00 00    06 00 00 00    00 00 00 00     ........ ........
00 00 00 00    00 00 00 00    88 11 BE 04    5C 10 BE 04     ........ ....\...
00 00 00 00    20 CD CD CD                                   ........ ........

This software is provided "AS IS" without warranty of any kind.

The project was originally developed by Dan Moulding, but they are no longer supported. Features of version 2.0 are implemented by Arkadiy Shapkin (me).

Links

 

Last edited Jan 10 at 5:30 AM by KindDragon, version 22


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM