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.

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: