Use UMDH to identify memory leak problem

编程入门 行业动态 更新时间:2024-10-24 18:26:11

Use UMDH to identify memory leak problem

原文链接:https://www.thinksaas/group/topic/634356/

We sometimes got memory leak problem, and we need to find the leaked memory, Here is a usful tool from MS, UMDH, it is included in WinDBG install package.

It need the PDB files to analyse access the symbol table, then a human readable stack can be generated.
You need to generated two set of current used memory, and compare the two to have a result.
It compares the current used memory, so you can identify the still-in-use memory, That is the memory you stored somewhere, but they will actually never be used again, and should be released.
And of cause, it can identify the memory with out a ptr pointing to when comparing.
You should let memory leak a little more to get a clear view of the result.
Here is the steps to use UMDH:
1. Install Windbg, you can get WinDBG from MS site:http://msdn.microsoft/en-us/windows/hardware/hh852365
2. Open a Dos Prompt as Administrator and navigate to the installation folder of WinDbg
3. Set Symbol Path as a System Variable

set _NT_SYMBOL_PATH= SRV*C:websymbols*http://msdl.microsoft/download/symbols; c:xosymbol

  1. Download PDB file and copy to the “C:xosymbol” which is set part of above environment variable “_NT_SYMBOL_PATH”
  2. Start collecting stack traces for user-mode allocations, run command:
    gflags /i +ust

  3. Restart your process.

  4. Keep it running, wait until it become steady..
  5. Collect a baseline snapshot, run command:
    umdh -pn: -f:c:1.log

  6. Wait until the memory usage of your process exceeds 1GB or more.

  7. Generate a new snapshot, run command:
    umdh -pn: -f:c:2.log

  8. Compare the two snapshots and get the final report from UMDH
    umdh -d c:1.log c:2.log > c:
    esult12.log

  9. In the result, we can see the stack where the leaked memory is allocated, You got a direct hint to resolve the leak problem.
    And if you need an example, please go to page https://www.hyzblog/use-umdh-identify-memory-leak-problem/

更多推荐

Use UMDH to identify memory leak problem

本文发布于:2023-06-14 05:08:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1441133.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:identify   UMDH   memory   problem   leak

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!