4

我有一个内存转储。在这个转储中,我有一个带有句柄的堆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 显示如下:

 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 MB。差距如此之大。这怎么可能?当我运行时,!heap -s我看到多个这样的条目:

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

也许这就是原因?

4

1 回答 1

1

!heap众所周知,当大量分配流经堆管理器时,某些开关的行为不正确。堆管理器将大分配直接转发到VirtualAlloc,虽然一些!heap命令知道如何跟踪这些分配,但其他命令不知道。您还应该尝试将您的 WinDbg 版本更新为最新的 Windows SDK,因为这些!heap命令与堆管理器的内部数据结构密切相关,这些数据结构会随 Windows 版本而变化。

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

于 2015-07-23T11:27:11.287 回答