My problem is that dumpheap -stat
returns an awful lot of objects and I have no idea which ones are rooted and which ones are not.
Well, I can if I run the !mroot
or !refs
command on an individual address, but this approach does not scale very well to thousands of objects reported by dumpheap
.
For example, dumpheap -stat
contains the following line:
000007fef3d14088 74247 2375904 Microsoft.Internal.ReadLock
Wow, 74,247 instances. However, running
.logopen c:\tmp\2\log.txt;.foreach (entry {!dumpheap -type Microsoft.Internal.ReadLock -short}){!refs ${entry} -target};.logclose
reveals that each and every instance reported by DumpHeap
is actually unreclaimed garbage!
How I found that each and every instance is garbage is another problem. I had to extract all the NONE
strings to one file and all the Objects referencing
strings to another and then compared the number of lines in every file. Surely there is a better way :-(.
Anyway, I would like to know how to focus on the rooted objects only. Ideally, I would like to get the statistics as well as details on such objects.