Calculating the size of each GC generation

Sos.dll does not have a command to tell the size of each GC generation. However, you can calculate the size based on the output of !eeheap -gc.

For example,

0:000> !eeheap -gc

Number of GC Heaps: 1

generation 0 starts at 0x1da6c430

generation 1 starts at 0x1da5c240

generation 2 starts at 0x01a41000

ephemeral segment allocation context: none

 segment begin allocated size

01a40000 01a41000 02a1cc4c 0x00fdbc4c(16628812)

0c7f0000 0c7f1000 0d7e9fc8 0x00ff8fc8(16748488)

12170000 12171000 13164488 0x00ff3488(16725128)

13170000 13171000 14117640 0x00fa6640(16410176)

10170000 10171000 1115b134 0x00fea134(16687412)

14170000 14171000 1516fdec 0x00ffedec(16772588)

1e030000 1e031000 1eff9970 0x00fc8970(16550256)

0e6e0000 0e6e1000 0f6dce50 0x00ffbe50(16760400)

15170000 15171000 160f7a60 0x00f86a60(16280160)

16170000 16171000 170f7bc0 0x00f86bc0(16280512)

17170000 17171000 180ffefc 0x00f8eefc(16314108)

18170000 18171000 191144dc 0x00fa34dc(16397532)

19170000 19171000 1a167e84 0x00ff6e84(16739972)

1a170000 1a171000 1b166a68 0x00ff5a68(16734824)

1b170000 1b171000 1c115a9c 0x00fa4a9c(16403100)

1d030000 1d031000 1db35130 0x00b04130(11551024)

Large object heap starts at 0x02a41000

 segment begin allocated size

02a40000 02a41000 03a07fc8 0x00fc6fc8(16543688)

072c0000 072c1000 082b6608 0x00ff5608(16733704)

11170000 11171000 11325aa0 0x001b4aa0(1788576)

Total Size 0x11961cdc(295050460)

------------------------------

GC Heap Size 0x11961cdc(295050460)

 

Gen2 size = 0x1da5c240 - 1d031000 + 16628812 + 16748488 + 16725128 + 16410176 + 16687412 + 16772588 + 16550256 + 16760400 + 16280160 + 16280512 + 16314108 + 16397532 + 16739972 + 16734824 + 16403100 .

 

Gen1 size = 0x1da6c430 - 0x1da5c240.

 

Gen0 size =  0x1db35130 - 0x1da6c430