Figuring out object allocation graph from a managed memory dump

 

when debugging a managed memory dump, we can use Sos.dll to inspect managed objects inside the dump.

for example, we can do !dumpheap to list the managed objects in GC Heap, we can also use !gcroot to figure out the reference path to a particular object.

However, if we want to understand the whole picture, !gcroot isn't going to cut it.

Then we can do !traverseheap. It writes the GC information to a format understood by CLR Profiler. We can then use CLR Profiler to inspect the object allocation graph.

https://msdn2.microsoft.com/en-us/library/bb190764(VS.80).aspx

TraverseHeap [ -xml] <filename>

Writes heap information to the specified file in a format understood by the CLR Profiler. The -xml option causes the TraverseHeap command to format the file as XML.

You can download the CLR Profiler from: https://www.microsoft.com/downloads/details.aspx?FamilyID=a362781c-3870-43be-8926-862b40aa0cd0&DisplayLang=en