Memo: How to use UMDH to detect memory leak

1.       Download windows debug tools from MS

2.       Based on the app type (x86 or x64), add path : C:\Program Files (x86)\Windows Kits\8.0\Debuggers\x86(or x64)

3.       For all the dlls and exes I wanna detect: run

a.       Gflags –i <dll name or exe name> +ust

4.       Find you *.pdb, make sure it exist in _NT_SYMBOL_PATH

5.       Start the app

6.       UMDH –pn:<app name> -f:file1.log

7.       do something in app, make sure the leak happens

8.       UMDH –pn:<app name> -f file2.log

9.       Compare the two files:

a.       UMDH –d file1.log file2.log –f:result.log

10.   Use notepad to check the result.log

a.       Check the items in result.log, item like

+ 21560112 ( 33410790 - 11850678)    905 allocs            BackTrace14DA8214

+     584 (    905 -    321)            BackTrace14DA8214        allocations

 

        ntdll!RtlUlonglongByteSwap+B52

        MSVCR100D!malloc_base+E3

        MSVCR100D!malloc_dbg+31C

        MSVCR100D!malloc_dbg+BF

        MSVCR100D!malloc_dbg+544

        MSVCR100D!calloc_dbg+2C

        MSVCR100D!calloc+19

Means there are about 21MB memory potential memory leak found(this call stack happened in 584 times). I call it potential because I must check code to make sure whether this is a correct behavior or a memory leak.

 

 

 

posted on 2012-09-28 10:41  learner  阅读(434)  评论(0编辑  收藏  举报

导航