srv*C:/symbol*http://msdl.microsoft.com/download/symbols;D:DesktopCMS_Dump
symck //检查pdb
lm //显示pdb
//写入日志文件
.logopen d:output.txt
.logclose
.logfile
!heap -s //显示堆信息
!heap -a 019e0000 //查看泄漏的堆信息
!heap -flt s size //打印所有内存变量(有用)
!address 打印内存信息(有用)
Largest free region(最大可分配的内存块空间)
------------- windbg 中对其动态调试 示例 --------------------
一. 查看初始的堆状态
!heap -s
二. 统计一下这个堆里的内存分配情况,发现 1000 字节的内存分配占了 86.97%,目标就锁定它了。
!heap -stat -h 00230000
size #blocks total ( %) (percent of total busy bytes)
1000 158 - 158000 (86.97)
三. 看一下都是哪些堆申请的
!heap -flt s 1000
四. 挑几个地址看一下调用栈
!heap -p -a 0303aec0
address 0303aec0 found in
_HEAP @ 230000
HEAP_ENTRY Size Prev Flags UserPtr UserSize - state
0303aec0 0221 0000 [00] 0303aed8 01000 - (busy)
7707dd6c ntdll!RtlAllocateHeap+0x00000274
7541f947 KERNELBASE!FindNextFileW+0x00000090
...
...
771a3c45 kernel32!BaseThreadInitThunk+0x0000000e
770637f5 ntdll!__RtlUserThreadStart+0x00000070
770637c8 ntdll!_RtlUserThreadStart+0x0000001b
---------------------------------------
dt -s 4c -n DMS_Server!* //查找4c长度的结构体等
dt -v DMS_Server!DataRow 376c4b58+8 //release头 +8
~*k 查看所有线程的堆栈
//在vs中查看
*(DataRow*)(0x18302b88)
0:004> !address 0x0E41F420
0e419000 : 0e419000 - 00007000
Type 00020000 MEM_PRIVATE
Protect 00000004 PAGE_READWRITE
State 00001000 MEM_COMMIT
Usage RegionUsageStack 栈
Pid.Tid 554.b74
0:004> !address 003f0000
003f0000 : 003f0000 - 00010000
Type 00020000 MEM_PRIVATE
Protect 00000004 PAGE_READWRITE
State 00001000 MEM_COMMIT
Usage RegionUsageHeap 堆
Handle 003f0000