windows – Windbg!heap -s和!heap -stat命令不同意输出

前端之家收集整理的这篇文章主要介绍了windows – Windbg!heap -s和!heap -stat命令不同意输出前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个内存转储.在这个转储中,我有一个句柄为fd00000的堆.这是!heap -s fd00000命令输出的摘录:

0: Heap 0fd00000
 Flags          00001002 - HEAP_GROWABLE 
 Reserved memory in segments              80192 (k)
 Commited memory in segments              56540 (k)
 Virtual bytes (correction for large UCR) 60592 (k)
 Free space                               3884 (k) (572 blocks)
 External fragmentation          6% (572 free blocks)
 Virtual address fragmentation   6% (69 uncommited ranges)
 Virtual blocks  124 - total 0 KBytes
 Lock contention 23
 Segments        1

您会看到它按预期显示摘要信息.但是!heap -stat -h 0fd00000的ouptut
显示以下内容

heap @ 0fd00000
 group-by: TOTSIZE max-display: 20
 size     #blocks     total     ( %) (percent of total busy bytes)
 19fa40 7a - c614280  (93.96)
 62d30 4 - 18b4c0  (0.73)
 d49 13d - 107365  (0.49)

它都是十六进制的,所以从这里我看到“总忙字节数”超过205 MBytes.所以你看到了!heap -s告诉我这个堆有80 MB / 60 MB的保留/虚拟内存,而!heap -stat告诉我这个堆占用205 MBytes.缺点是如此巨大.这怎么可能?当我运行!heap -s时,我看到多个这样的条目:

Virtual block: 293c0000 - 293c0000 (size 00000000)

也许这就是原因?

解决方法

当大型分配流经堆管理器时,已知某些!堆交换机的行为不正确.堆管理器将直接将大型分配转发给VirtualAlloc,而某些!heap命令知道如何跟踪这些分配,而其他命令则不知道.您还应该尝试将WinDbg版本更新到最新的Windows SDK,因为!heap命令与堆管理器的内部数据结构密切相关,后者随Windows版本而变化.

我建议在这种情况下使用VMMap来检测大型分配源.

猜你在找的Windows相关文章