I am using windbg to debug a memory issues on Win7.
I use !heap -s and got following output.
0:002> !heap -s
LFH Key : 0x6573276f
Termination on corruption : ENABLED
Heap Flags Reserv Commit Virt Free List UCR Virt Lock Fast
(k) (k) (k) (k) length blocks cont. heap
-----------------------------------------------------------------------------
000f0000 00000002 1024 552 1024 257 7 1 0 0 LFH
00010000 00008000 64 4 64 2 1 1 0 0
00330000 00001002 1088 160 1088 5 2 2 0 0 LFH
00460000 00001002 256 4 256 2 1 1 0 0
012c0000 00001002 1088 408 1088 8 10 2 0 0 LFH
00440000 00001002 1088 188 1088 24 9 2 0 0 LFH
01990000 00001002 1088 188 1088 24 9 2 0 0 LFH
00420000 00001002 1088 152 1088 5 2 2 0 0 LFH
01d20000 00001002 64 12 64 3 2 1 0 0
01c80000 00001002 64 12 64 1 2 1 0 0
012e0000 00001002 776448 118128 776448 109939 746 532 0 0 LFH
External fragmentation 93 % (746 free blocks)
Virtual address fragmentation 84 % (532 uncommited ranges)
01900000 00001002 256 4 256 1 1 1 0 0
01fa0000 00001002 256 108 256 58 3 1 0 0
01c40000 00001002 64 16 64 4 1 1 0 0
03140000 00001002 64 12 64 3 2 1 0 0
33f40000 00001002 64 4 64 2 1 1 0 0
340f0000 00001002 1088 164 1088 3 5 2 0 0 LFH
-----------------------------------------------------------------------------
My question is what is External fragmentation and what is Virtual addess fragmentation? And what does 93% and 84% mean?
Thank you in advance.
The output of WinDbg refers to the heap before the fragmentation numbers, in your case the heap 012e0000
.
External fragmentation = 1 - (larget free block / total free size)
This means that the largest free block in that heap is 7.63 MB, although the total free size is 109 MB. This typically means that you can't allocate more than 7.63 MB in that heap at once.
For a detailed description of external fragmentation, see also Wikipedia.
Virtual address fragmentation: 1 - (commit size / virtual size)
While I have not found a good explanation for virtual memory fragmentation, this is an interpretation of the formula: virtual size is the total available memory. Commit size is what's used. The difference (1 - x) is unusable.
You can go into more details on that heap using !heap -f -stat -h <heap>
(!heap -f -stat -h 012e0000
in your case).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With