ANTS Memory Profiler 7

Working with the Instance Categorizer

Use the Instance Categorizer to investigate the paths that are holding classes in memory.

The instance categorizer shows reference relationships between classes, which can help identify instances that are unexpectedly kept in memory. This can be particularly useful if your snapshot analysis identifies a class you do not recognize: Use the explorer to follow chains of references to the class, until you reach a class you recognize which may be responsible for the memory usage.

When you apply filters, the instance categorizer only includes the filtered objects.

The instance categorizer has two different views:

  • Categorized references view
  • All references view

Categorized references view

This is the default view. In this view, instances of the selected object are categorized by the shortest path to a GC Root. The path responsible for holding most instances of the selected class is shown at the top.

To see the instances that each category contains, click your selected class (in black, on the right), and then click Show instance list.

All references view

In the all references view, your selected class is shown at the center of the graph (in black). Classes to the left have instances that reference any instance of the selected class; classes to the right have instances which are referenced by at least one instance of the selected class.

Tips

  • The percentage shown on a class indicates the proportion of instances of the selected class (in the center) that are connected to it by references along that path. Look at the percentages on classes to the left of the selected class to assess which classes are responsible for instances of the selected class being in memory.
  • To find out why your selected class is unexpectedly large, look at the class that is responsible for most references to the selected class.
    • In the categorized references view, this is on the top row, to the left of the selected class. Click the class to expand the graph, showing classes that reference this class.
    • In all references view, this is the class at the top-left of the graph. Follow the path to the left to see classes that reference this class.
  • The graph shows all references between classes, so you may find that as you expand classes and follow references along a particular path you start to see the same classes repeatedly in the path. This is a circular reference chain, and you are unlikely to find useful information by continuing to follow it. Instead, click Show instances of this class on this path to display the instance list for one of the classes on this path, and then display the instance retention graph for an instance, to investigate why the instance is in memory.
  • If you are looking for the Class Reference Explorer from ANTS Memory Profiler 6 and earlier, select All references view.

Didn't find what you were looking for?