为什么!heap -s heap不按预期方式工作?

时间:2016-12-02 11:50:13

标签: windbg

我的WinDBG版本是10.0.10240.9 AMD64,在随便调试一些本机内存转储时,我意识到我的!heap命令行为与描述不同,我无法弄清楚原因。

有很多资源提到!heap -s

执行!heap -s

我得到了这个截断的列表:

0:000> !heap -s

************************************************************************************************************************
                                              NT HEAP STATS BELOW
************************************************************************************************************************
LFH Key                   : 0x000000c42ceaf6ca
Termination on corruption : ENABLED
          Heap     Flags   Reserv  Commit  Virt   Free  List   UCR  Virt  Lock  Fast 
                            (k)     (k)    (k)     (k) length      blocks cont. heap 
-------------------------------------------------------------------------------------
Virtual block: 0000000003d40000 - 0000000003d40000 (size 0000000000000000)
... many more virtual blocks
0000000000b90000 00000002 3237576 3220948 3237576  20007  1749   204  359      0   LFH
0000000000010000 00008000      64      8     64      5     1     1    0      0      
... more heaps
-------------------------------------------------------------------------------------

好的,b90000看起来很大,但与上面那些文档相反,!heap -s -?我无法获得这个堆的信息,这些命令中的每一个都产生与上面看到的完全相同的输出(好像我会在-s之后没有指定任何内容:

!heap -s b90000
!heap -s -h b90000
!heap -s 1

我获得了大量虚拟块和所有堆的转储,而不是单个指定的堆。

任何人有同样的问题吗?

1 个答案:

答案 0 :(得分:1)

我的“Windows调试器版本10.0.10586.567 AMD64”表现得和你的一样,但是 “Microsoft(R)Windows调试器版本6.3.9600.16384 AMD64”我在:  C:\ Program Files \ Windows Kits \ 8.1 \ Debuggers \ x64

0:000> !heap -s -h 0000000000220000 
Walking the heap 0000000000220000 ..................Virtual block: 0000000015f20000 - 0000000015f20000 (size 0000000000000000)
Virtual block: 000000001b2e0000 - 000000001b2e0000 (size 0000000000000000)
Virtual block: 000000001f1e0000 - 000000001f1e0000 (size 0000000000000000)
Virtual block: 0000000023c10000 - 0000000023c10000 (size 0000000000000000)
Virtual block: 000000001c060000 - 000000001c060000 (size 0000000000000000)
Virtual block: 000000001ddc0000 - 000000001ddc0000 (size 0000000000000000)

 0: Heap 0000000000220000
   Flags          00000002 - HEAP_GROWABLE 
   Reserved memory in segments              226880 (k)
   Commited memory in segments              218204 (k)
   Virtual bytes (correction for large UCR) 218740 (k)
   Free space                               12633 (k) (268 blocks)
   External fragmentation          5% (268 free blocks)
   Virtual address fragmentation   0% (30 uncommited ranges)
   Virtual blocks  6 - total 0 KBytes
   Lock contention 0
   Segments        1

   Low fragmentation heap   00000000002291e0
       Lock contention        0
       Metadata usage     90112 bytes
       Statistics:
           Segments created     993977
           Segments deleted     992639
           Segments reused           0
       Block cache:
         3:         1024 bytes (    17,     0)
         4:         2048 bytes (    42,     0)
         5:         4096 bytes (   114,     0)
         6:         8192 bytes (   231,     2)
         7:        16384 bytes (   129,     9)
         8:        32768 bytes (   128,    11)
         9:        65536 bytes (   265,    58)
        10:       131072 bytes (   357,     8)
        11:       262144 bytes (   192,    49)

       Buckets info:
  Size   Blocks  Seg  Empty  Aff    Distribution
------------------------------------------------
------------------------------------------------

                    Default heap   Front heap       Unused bytes
   Range (bytes)     Busy  Free    Busy   Free     Total  Average 
------------------------------------------------------------------ 
     0 -   1024      577    140 1035286  11608   10563036     10
  1024 -   2048      173      3    586    374      27779     36
  2048 -   3072       17     19     47    224       1605     25
  3072 -   4096       20     12      1    126        348     16
  4096 -   5120       35      3      1     30        677     18
  5120 -   6144        2      8      0      0         33     16
  6144 -   7168        5      9      0      0         56     11
  7168 -   8192        0     11      0      0          0      0
  8192 -   9216       14      0      0     15        236     16
  9216 -  10240        1      0      0      0          8      8
 12288 -  13312        1      0      0      0         17     17
 14336 -  15360        1      0      0     18          1      1
 15360 -  16384        1      0      0      0         32     32
 16384 -  17408       10      0      0      0        160     16
 22528 -  23552        1      0      0      0          9      9
 23552 -  24576        2      0      0      0         32     16
 27648 -  28672        1      0      0      0          8      8
 30720 -  31744        0      1      0      0          0      0
 32768 -  33792       18      0      0      0        250     13
 33792 -  34816        0      1      0      0          0      0
 39936 -  40960        0      2      0      0          0      0
 40960 -  41984        0      1      0      0          0      0
 43008 -  44032        0      2      0      0          0      0
 44032 -  45056        0      5      0      0          0      0
 45056 -  46080        0      1      0      0          0      0
 46080 -  47104        0      2      0      0          0      0
 47104 -  48128        0      1      0      0          0      0
 49152 -  50176        0      3      0      0          0      0
 50176 -  51200        1      0      0      0         16     16
 51200 -  52224        0      4      0      0          0      0
 57344 -  58368        0      1      0      0          0      0
 58368 -  59392        0      1      0      0          0      0
 62464 -  63488        0      1      0      0          0      0
 63488 -  64512      200      1      0      0       3200     16
 64512 -  65536        0      1      0      0          0      0
 65536 -  66560     1029      2      0      0      10624     10
 79872 -  80896      100      0      0      0        900      9
131072 - 132096        9      0      0      0        144     16
193536 - 194560        1      0      0      0          9      9
224256 - 225280        1      0      0      0         16     16
262144 - 263168       49     27      0      0        784     16
327680 - 328704        1      0      0      0         17     17
384000 - 385024        0      1      0      0          0      0
523264 - 524288        1      5      0      0         23     23
------------------------------------------------------------------ 
  Total             2271    268 1035921  12395   10610020     10

这可能是一个散步, 不能回答为什么胜利10版本不起作用: - (