The new instance graph gives you a visual overview of how a managed instance is
being used, how it is related to other instances, and, maybe most importantly, how
roots are preventing it from being garbage collected.
Watch
the demo.
The instance graph is available in the
Instance details view. The graph can become rather large, so it is recommended
that the graph is maximized when working with the graph. Or if multiple monitors
are used, the graph can be dragged to another screen.
Watch
the demo.
The graph can include all instances that are related to the selected instance. This includes instances and roots that
can reach the selected instance, and instances that are reachable from the selected instance. By default, only root path instances and held instances are
included in the graph, i.e. the instances and roots that are preventing the
selected instance from being garbage collected and the instances that are uniquely reachable from the selected instance.
To select which instances to include in the graph, use the Include menu (
).
Watch
the demo.
Investigating root paths in a large graph
If the instance graph is large, it can be hard to locate specific root paths. In
this case the Align root path command is useful. This
command is available from the popup window of each instance, root, and reference
in the graph, as well as from the right click menu. When selected, it will find
the shortest root path that passes through the instance, root, or reference, highlight
the root path and group all instances. Root paths can also be selected using the
navigation buttons that are provided on the sides of the graph. For more information
watch the root path navigation demo.
Watch
the demo.
Large instance graph reduction
An instance graph can easily become much larger than can be conveniently presented
visually. To avoid presenting too large graphs, .NET Memory Profiler will reduce the graph by
combining groups of instances and roots into single graph nodes. The profiler tries
to select groups so that the overall structure of the graph is affected as little
as possible.
Combined instances can be expanded by using the Expand command that is available
in the popup window and right-click menu of the combined instances and combined
references. The expand options depend on how the instances and references have been
combined. Typically they include options for expanding a specific type, a field,
or just a number of instances. For more information see the demo.
Watch
the demo.