0

I have a .NET application that uses many IDisposable types. In one of environment, application is showing high memory usage. I collected a dump file and see following.

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)

The memory usage seem to coming out from the native side of things. The managed memory consumption doesn't seem to be significant.

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.

What can I do to determine what objects are responsible for this much memory?

jim crown
  • 473
  • 3
  • 11
  • Use a memory profiler like [this](http://www.red-gate.com/products/dotnet-development/ants-memory-profiler) one. – Xaqron Apr 01 '17 at 00:47
  • @Xaqron I am trying to understand if this could be resolved using Windbg/SOS. – jim crown Apr 01 '17 at 00:56
  • It seems you know from your code what kind of IDisposable you have. You should also have an idea of which type uses much memory (e.g. bitmaps). What about `!dumpheap -stat`, then find those types? – Thomas Weller Apr 01 '17 at 08:56

0 Answers0