• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            posts - 311, comments - 0, trackbacks - 0, articles - 0
              C++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

            Visual Leak Detector是一款免費的檢查內存泄露的工具。最新的2.1版本可以很好的支持VS2008/2010。

            點擊這里下載

             

            安裝后,在VS中設置Tool->Options 選擇Projects and Solutions中的VC++ Directories,將Visual Leak Detector安裝路徑中的include和lib路徑設置Include Files和Library Files中,如有必要可以將安裝路徑下bin里的相應dll拷貝至System32下。

            創建一個簡單的工程,其中指針b所指向的內存沒有被正確地釋放。

            1. void leak()
            2. {
            3. int *b = new int[10];
            4. for (int i = 0; i < 10; ++i)
            5. {
            6. b[i] = i;
            7. }
            8. }
            9. int main()
            10. {
            11. leak();
            12. return 0;
            13. }

             

            include<vld.h>,運行就能在output窗口看到效果啦。

             

            輸出的部分主要分為兩塊

            Call Stack部分:

            是泄露內存的調用堆棧,其中顯示了泄露資源創建的位置,雙擊便可以定位到相應的代碼部分。

            Data部分:

            即使泄露部分的內存內容。

             

            注:在自己機器上VS2008上,用了下1.0和1.9b的版本,都出現了不同的問題(1.0版本不能定位泄露代碼,1.9b沒有正確檢查出泄露)。2.1版本運行一切正常。

            Project Description

            Visual Leak Detector is a free, robust, open-source memory leak detection system for Visual C++.

            It's pretty easy to use. After installing it, you just need to tell Visual C++ where to find the included header and library file.

            Then it can be used with any C/C++ project simply by adding the following line to your code:
            #include <vld.h> 

            When you run your program under the Visual Studio debugger, Visual Leak Detector will output a memory leak report at the end of your debugging session. The leak report includes the full call stack showing how any leaked memory blocks were allocated. Double-click on a line in the call stack to jump to that file and line in the editor window.

            It's a very effective way to quickly diagnose, and fix, memory leaks in C/C++ applications.

            The main difference between the CRT Debug Library and VLD, is that Visual Leak Detector shows you the complete callstack used for memory allocation has led to the leak.

            For example:

             

            ---------- 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).

            一本久久a久久精品亚洲| 欧洲国产伦久久久久久久| 久久精品亚洲中文字幕无码麻豆| 久久人人爽人人爽人人片av高请| 久久久久久久综合日本亚洲| 日日狠狠久久偷偷色综合0| 中文字幕热久久久久久久| 91精品国产综合久久四虎久久无码一级| 久久播电影网| 久久97精品久久久久久久不卡| 偷窥少妇久久久久久久久| 伊人色综合久久天天| 亚洲日本va中文字幕久久| 国产成人精品久久亚洲高清不卡 | 无码任你躁久久久久久老妇App| 精品一区二区久久久久久久网站| 婷婷久久五月天| 国产日韩久久免费影院| 91精品国产综合久久精品| 模特私拍国产精品久久| 精品久久久久久无码中文野结衣 | 国内精品久久九九国产精品| 伊人久久亚洲综合影院| 久久国产成人亚洲精品影院| 久久国产精品无码一区二区三区| 久久天天躁狠狠躁夜夜avapp| 久久99精品国产麻豆婷婷| 久久精品国产福利国产秒| 久久精品aⅴ无码中文字字幕重口| 久久久久国产精品人妻| 一本色道久久88综合日韩精品 | 99国产欧美精品久久久蜜芽| 色欲久久久天天天综合网精品 | 97久久精品人人做人人爽| 久久久久久久综合日本亚洲| 久久久久久综合一区中文字幕| 国产精品久久久久久吹潮| 久久久久亚洲AV无码网站| 77777亚洲午夜久久多喷| 精品久久一区二区| 国产A级毛片久久久精品毛片|