dotMemory 2024.2 Help

Dominators

The Dominators view lets you understand how memory is retained in your app. For example, you know that strings consume a significant part of the memory in your app. Nevertheless, most likely, the subject of your optimizations is not these strings by themselves but the data structures that store them. The Dominators view answers the "Who retains the memory" question, which is extremely important when analyzing ineffective memory usage. To answer this question correctly, you should be acquainted with the concept of dominators.

What is a dominator?

Object A dominates object B if every path to B from the app's roots goes through A. In other words, object B is retained in memory exclusively by object A: If A is garbage collected, then B is also garbage collected. For example, an array is a dominator for its elements (in case there are no other references to array elements).

Objects retention example

If there is more than one path to an object from the app's roots, it is considered a non-dominated or not-exclusively-retained object. For example, if the object C is retained by objects A and B and A is garbage collected, C will stay in memory (as it is still referenced by B). That is why it is important to understand the difference between the domination and retention paths:

  • Domination path – an object on the path is retained only by one other object.

  • Retention path – an object on the path may be retained by any number of other objects.

The Dominators view consists of two parts:

  • A tree list of dominators on the left.

  • A chart on the right: a graphical representation of the tree list.

Dominator tree

The tree on the right shows the tree of dominators for the selected object set.

The tree can work in two modes that can be selected with the corresponding buttons in the tree header:

  • Tree: All dominator nodes are shown. The dominators that take part in a domination path for the selected tree node are shown in bold.

  • Path: Only the dominators that take part in a domination path for the selected tree node are shown.

The list of dominators consists of the following columns:

Name

Description

Type

Type name.

The number left to the type name shows how many objects of that type are retained that way. For example, elements of some array of integers A are retained in the exact same way (A -> element), but elements of an integer array B have another retention path (B -> element).

Retained Bytes

The overall size of exclusively retained objects in bytes.

Retained objects

The number of objects that are dominated by the dominator.

Chart visualization

Sunburst chart on the left is a graphical representation of the dominator tree. The more memory a dominator retains, the larger the central angle.

The analysis of the dominator tree can be quite complicated as you have to expand its nodes and interpret the numbers in the Retained bytes column. In contrast, a glance at the sunburst chart allows you to determine the main dominators and largest structures in your app. A click on a dominator you're interested in will show you its domination path in the tree.

Consider the example below for a better understanding of how the sunburst chart displays data from the dominator tree.

Zooming in and out

If you want to take a more detailed look at a certain dominator subtree, you can change the scale of the chart.

To zoom in on a dominator

  • Do one of the following:

    • Double-click the corresponding arc in the chart.

    • Double-click the dominator in the tree or select the tree and press Enter.

    The dominator will become a root of the chart.

To zoom back out

  • Click the center of the chart.

Example

Group by Dominators example

Filter objects

You can filter out objects that are of no interest to your analysis by type .

To narrow the list

  • Start typing the desired string pattern. dotMemory will highlight matching strings.

You can make your search more efficient by using the following tips:

  • Use CamelHumps. E.g. fo will return objects of both System.Drawing.Font and MS.Utility.FrugalObjectList types.

  • Use special symbols, like wildcards and others. The full list is shown in the table below.

Special symbols and filter examples

Symbol

Description

Example

*

Wildcard

*


All objects in the set

sys.*.data


All types and namespaces that match the pattern. E.g. System.Data, System.Windows.Controls.Datagrid, and System.Windows.Data.Binding.

sys.*.data.


Only namespaces that match the pattern. E.g. System.Windows.Data.Binding but not System.Windows.Controls.Datagrid.

Arrays

[]

Leave only arrays

str[]


Arrays, containing str in their type or namespace. E.g. String[].

[,


[,,


...


or


[,]


[,,]


...

Leave only arrays of the specified or higher (if brackets are not closed) dimension

str[,,


Arrays with the dimension 3 and higher containing str in their type or namespace. E.g. String[,,] and String[,,,].

str[,,]


Three-dimensional arrays containing str in their type or namespace. E.g. String[,,].

!a

Exclude arrays from the result

!a str


Objects (excluding arrays) containing str in their type or namespace. E.g. String but not String[].

Generic type arguments

<

Leave only types with generic type arguments

str<


Only objects containing str in their type or namespace and having generic type arguments. E.g. FileStreamStorage<Char> but not List<String>.

<str


Only objects containing str in their generic type arguments. E.g. List<String> but not FileStreamStorage<Char>.

<,


<,,


...


or


<,>


<,,>


...


Leave only objects with the specified number of generic type arguments

fun<,,>


Objects containing fun in their type or namespace and having three generic type arguments. E.g. Func<String, Object, Object>.

fun<str,,task


Objects containing fun in their type or namespace and having three or generic type arguments that match the pattern. E.g. Func<Stream, IAsyncResult, TaskResult, EventArgs>.

!g

Exclude generic type arguments from the search scope

!g str


Objects (that do not have generic type arguments) containing str in their type or namespace. E.g. String but not List<String>.

#c


#struct


#m


#ns

Search by type, value type, method, or namespace.

#ns Feature


Objects containing Feature in their namespace.

Select objects for further analysis

In the Dominators view, you can select the following subjects for further analysis:

To open objects retained by a particular dominator

  • Do one of the following:

    • Hold Alt and click the dominator in the tree or on the chart.

    • Right-click the dominator and select Open objects retained via this domination path in the context menu.

    After this, the Objects retained via [type_name] subject will be added to the Analysis Path and the list of desired objects will be displayed in the Group by Types view.

To open the dominator object set

  • Do one of the following:

    • Hold Shift and click the dominator in the tree or on the chart.

    • Right-click the dominator and select Open this object set in the context menu.

    After this, the Dominators of [type_name] subject will be added to the Analysis Path and the list of desired objects will be displayed in the Group by Types view.

To select the objects that are exclusively retained by the analyzed objects set

  • Click the Open retained objects Open objects retained by this set button.

    After this, the Exclusively retained objects subject will be added to the Analysis Path and the list of desired objects will be displayed in the Group by Types view.

Last modified: 24 July 2024