Memo: How to use UMDH to detect memory leak
2012-09-28 10:41
363 查看
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.
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.
相关文章推荐
- How to use umdh to check Windows memory leak
- How to use windbg to detect memory leak
- Use UMDH to identify memory leak problem
- Use UMDH to identify memory leak problem
- How to detect memory leak issue
- Use UMDH to identify memory leak problem
- Hook API to detect memory leak
- 《How to Use the TimeDistributed Layer for Long Short-Term Memory Networks in Python》学习笔记
- How to Find A Memory Leak
- How to detect and avoid memory and resources leaks in .NET applications
- How to Use the TimeDistributed Layer for Long Short-Term Memory Networks in Python 译文
- Use SOS to investigate the memory leak
- How to detect and avoid memory and resources leaks in .NET applications()
- QSharedMemory: how to use
- C++ shared memory leak, how to clear shared memory?
- how to detect memory in memroy dump objects
- how to use seeta face engine to detect and recognize face
- Howto find native code memory leak in Android
- pmap study: how to find a memory leak.
- How to debug native memory leak in anroid