我有一个使用许多IDisposable类型的.NET应用程序。在其中一个环境中,应用程序显示高内存使用率。我收集了一个转储文件,看看如下。
0:000> !address -summary
Mapping file section regions...
Mapping module regions...
Mapping PEB regions...
Mapping TEB and stack regions...
Mapping heap regions...
Mapping page heap regions...
Mapping other regions...
Mapping stack trace database regions...
Mapping activation context regions...
--- Usage Summary ---------------- RgnCount ----------- Total Size -------- %ofBusy %ofTotal
Free 73 7ff`0e99f000 ( 6.112 Tb) 99.95%
Heap 35 0`d06ce000 ( 4.017 Gb) 86.34% 0.04%
<unknown> 56 0`1aebe000 ( 430.742 Mb) 11.15% 0.01%
Image 247 0`05600000 ( 86.000 Mb) 2.23% 0.00%
Stack 27 0`00900000 ( 9.000 Mb) 0.23% 0.00%
Other 9 0`001b2000 ( 1.695 Mb) 0.04% 0.00%
TEB 9 0`00012000 ( 72.000 kb) 0.00% 0.00%
PEB 1 0`00001000 ( 4.000 kb) 0.00% 0.00%
--- Type Summary (for busy) ------ RgnCount ----------- Total Size -------- %ofBusy %ofTotal
MEM_PRIVATE 116 0`ea4a6000 ( 3.661 Gb) 97.06% 0.04%
MEM_IMAGE 248 0`05601000 ( 86.004 Mb) 2.23% 0.00%
MEM_MAPPED 20 0`01baa000 ( 27.664 Mb) 0.72% 0.00%
--- State Summary ---------------- RgnCount ----------- Total Size -------- %ofBusy %ofTotal
MEM_FREE 73 7ff`0e99f000 ( 6.112 Tb) 99.95%
MEM_COMMIT 337 0`d605a000 ( 3.344 Gb) 88.66% 0.04%
MEM_RESERVE 47 0`1b5f7000 ( 437.965 Mb) 11.34% 0.01%
--- Protect Summary (for commit) - RgnCount ----------- Total Size -------- %ofBusy %ofTotal
PAGE_READWRITE 120 0`d0427000 ( 4.014 Gb) 86.27% 0.04%
PAGE_EXECUTE_READ 32 0`03de6000 ( 61.898 Mb) 1.60% 0.00%
PAGE_READONLY 102 0`00fe7000 ( 15.902 Mb) 0.41% 0.00%
PAGE_WRITECOPY 44 0`00cf9000 ( 12.973 Mb) 0.34% 0.00%
PAGE_EXECUTE_WRITECOPY 10 0`0012f000 ( 1.184 Mb) 0.03% 0.00%
PAGE_READWRITE|PAGE_GUARD 9 0`00022000 ( 136.000 kb) 0.00% 0.00%
PAGE_EXECUTE_READWRITE 19 0`0001b000 ( 108.000 kb) 0.00% 0.00%
PAGE_EXECUTE 1 0`00001000 ( 4.000 kb) 0.00% 0.00%
--- Largest Region by Usage ----------- Base Address -------- Region Size ----------
Free 1`00061000 7fd`834df000 ( 7.990 Tb)
Heap 0`1b050000 0`10001000 ( 256.004 Mb)
<unknown> 0`025f2000 0`0ffee000 ( 255.930 Mb)
Image 7fe`e1aba000 0`0102d000 ( 16.176 Mb)
Stack 0`1ac30000 0`000fc000 (1008.000 kb)
Other 0`00830000 0`00181000 ( 1.504 Mb)
TEB 7ff`ffef8000 0`00002000 ( 8.000 kb)
PEB 7ff`fffda000 0`00001000 ( 4.000 kb)
内存使用似乎来自本机方面。管理内存消耗似乎并不重要。
0:000> !EEHeap -gc
Number of GC Heaps: 1
generation 0 starts at 0x00000000025e1030
generation 1 starts at 0x00000000025e1018
generation 2 starts at 0x00000000025e1000
ephemeral segment allocation context: none
segment begin allocated size
00000000025e0000 00000000025e1000 00000000025effe8 0xefe8(61416)
Large object heap starts at 0x00000000125e1000
segment begin allocated size
00000000125e0000 00000000125e1000 00000000125f1940 0x10940(67904)
Total Size: Size: 0x1f928 (129320) bytes.
------------------------------
GC Heap Size: Size: 0x1f928 (129320) bytes.
我该怎么做才能确定哪些对象对这么多内存负责?