标签:
AutomatedQA AQTime分析CPU占用,API调用序列,多种形式分析报告(AutomatedQA AQTime v6.20.355 x86.rar)
Windbg:logger.exe, logviewer.exe记录Windows API调用,umdh(User-Mode Dump Heap)
LeakDiag -- MS的查Leak工具,未用过
DebugDiag通过生成Dump文件来分析Crash, DeadLock, MemLeak, DeadLoop/BigLoop,还可以分析.Net程序的内存问题
根据经验,DebugDiag分析Debug程序时,即使有Pdb也定位不准确;Release程序配合Pdb分准确分析
DebugDiag分析Debug程序的结果:
msvcr80d.dll is responsible for 401.66 KBytes worth of outstanding allocations. The following are the top 2 memory consuming functions:
msvcr80d!operator new[]+d: 400.00 KBytes worth of outstanding allocations.
msvcr80d!_heap_alloc_base+5c: 1.66 KBytes worth of outstanding allocations.
DebugDiag分析Relase程序的结果:
MemLeakTest.exe is responsible for 800.00 KBytes worth of outstanding allocations. The following are the top 2 memory consuming functions:
MemLeakTest!GenMemLeak+46: 800.00 KBytes worth of outstanding allocations.
Windbg分析Debug Leak比较准确,但是分析Relase时,调用堆栈信息到msvcr*.dll时就没了
Windbg分析方法一(分析大程序时比较卡,rease不行,适用于debug):
1、用gflags打开create user mode stack trace database
2、!heap -s
3、执行操作
4、!heap -s
5、比较-s结果,用!heap -stat -h 0xHeapHandle
6、!heap -flt s 有可能泄露的size
7、!heap -p -a 0x内存地址
release时stack trace丢失例子:
0:001> !heap -p -a 08c78708
address 08c78708 found in
_HEAP @ 3e0000
HEAP_ENTRY Size Prev Flags UserPtr UserSize - state
08c78700 0203 0000 [07] 08c78708 01000 - (busy)
Trace: 009e
7c98cf9a ntdll!RtlDebugAllocateHeap+0x000000e1
7c969564 ntdll!RtlAllocateHeapSlowly+0x00000044
7c938f01 ntdll!RtlAllocateHeap+0x00000e64
78134d83 MSVCR80!malloc+0x0000007a
Windbg分析方法二(只对relase,一样的stack trace丢失):
1、用gflags去掉full page heap
2、!heap -l
BTW: full page heap可以检查数组等内存块越界访问情况!
DebugDiag使用方法:
一、准备:
1、菜单/Tools/Options And Settings,设置分析及调试(crash)的pdb路径。
2、_NT_SOURCE_PATH、_NT_SYMBOL_PATH环境变量
二、得到dump文件
1、常规使用方法是使用向导,向导里有Crash, Performance, Memory/Handle的Rule生成方法!
2、在进程中点右键选择Monitor for Leaks或Create Full Dump,这里产生的dump文件在logs\misc目录中.
注:performance里可以分析.net, iis/com+, web application pool, executable等
三、分析dump文件
1、添加dump文件
2、选择/双击分析脚本,便会得到分析结果(如果是perfomance等有多个dump的,在rule右键菜单点分析)
标签:
原文地址:http://www.cnblogs.com/gakusei/p/4520398.html