zoukankan      html  css  js  c++  java
  • DebugDiagx检测内存泄露

    1. 安装DebugDiagx63.exe

    2. 运行需要测试的程序UnitTest.exe.

    3. 打开DebugDiag1.2, 选择 ”Native (non-.Net) Memory and Handle Leak” ,然后next.

    4. 选中UnitTest.exe进程, next

    5. 保持default选择, next

    6. 生成Leak Rules, 保持default选择, next

    7. 保持”Active the rule now”选择, Finish.

    8. ToolsàOptions And Settings

    (1) Folders and Search Paths: 添加Symbols文件: SRV*D:\symbol*http://msdl.microsoft.com/download/symbols;D:\xxx-YourProjectPdbFilePath.

    Dump文件保存路径保持不变.

     

    (2) Preferences: 勾选”检测内存泄露时立即记录调用栈信息”,当测试时间>15mins时不建议勾选.

      

    9. 运行UnitTest程序,为了产生较多的泄露,可以多运行几次.

    10. Rules选项卡中,右键点击Leak RuleàDump Target Process(es)àCreate Full Userdump(s).从而生成dump文件.位置在E:\Program Files\DebugDiag\Logs\Misc下.

     

     11. Advanced Analysis选项卡, 选中第二个”Memory Pressure Analyzers” (第一个是分析托管的内存). 然后点击Add Data Files. 加载Misc文件夹下的dump文件, 然后点击”Start Analysis”按钮进行分析, 会生成一个html页面, 在IE中自动打开.

     

    12. 在页面中搜索,找到 ”Module details for mfc100”, 查询其 ”operator new”函数的调用栈samples. 可以找到代码中用到new可能造成的内存泄露之处.

    Function

    Source

    Destination

    mfc100!operator new+33

    TestCaseAdapter!CTracerouteAdapterFactory::CreateObject+2d

    d:\xxx\tracerouteadapter.cpp @ 39 + 8

    mfc100!operator new

    TestCases!TracerouteTest::testTracerouteWithWrongHost+153

    d:\xxx\traceroutetest.cpp @ 67 + 16

  • 相关阅读:
    用element-ui搭建后台框架
    给hover加上过渡效果
    vue搭建项目
    单选框的选中事件
    Javascript开发中让代码性能变高的小技巧
    这是一个弹幕
    纯CSS打造进度条
    fixed元素随滚动条无抖动滚动
    python3实现url全编码/解码
    如何入门漏洞挖掘,以及提高自己的挖掘能力(别人写的挺好)
  • 原文地址:https://www.cnblogs.com/zhcncn/p/2856000.html
Copyright © 2011-2022 走看看