dotMemory 2021.2 Help

Analyze Memory Allocation

Use the Memory Allocation view to analyze allocations on a specific time interval: find out what objects were allocated on this interval and what functions allocated these objects. The view can show you allocation data even when profiling is still in progress: memory snapshots are not required.

How to get memory allocation data

To analyze memory allocation on an arbitrary time interval

Analyzing traffic
  1. Start a profiling session or open an existing workspace (created in dotMemory 2021.1 or later).

  2. On the Timeline graph, select a desired time interval.

    Note that the desired time interval must contain the memory allocation data (it is shown with the green shaded line below the timeline graph). To turn on collecting memory allocation data, use the Collect Allocations button during profiling or select Collect memory allocation and traffic data from start when configuring the profiling session.

  3. Click the Allocated: ... MB link or the Show memory allocation button to open the Memory Allocation view.

    Open memory allocation view
  4. Choose how you want to analyze the data: using grouping by Types, by Methods, or by Call Tree.

To analyze memory allocation between start of the session and a specific snapshot

Analyzing traffic
  1. Start a profiling session or open an existing workspace.

  2. Under Memory Snapshots, find the required snapshot and click Memory allocation.

    Note that the time interval between the start of the session and a snapshot must contain the memory allocation data (it is shown with the green shaded line below the timeline graph). To turn on collecting memory allocation data, use the Collect Allocations button during profiling or select Collect memory allocation and traffic data from start when configuring the profiling session.

    View Memory Allocation Snapshot
  3. Choose how you want to analyze the data: using grouping by Types, by Methods, or by Call Tree.

To analyze memory allocation between two snapshots

Analyzing traffic
  1. Start a profiling session or open an existing workspace.

  2. Under Memory Snapshots, find the required snapshots and add them to the Snapshot Comparison area by clicking Add to comparison for each snapshot.

    Note that the time interval between the start of the session and a snapshot must contain the memory allocation data (it is shown with the green shaded line below the timeline graph). To turn on collecting memory allocation data, use the Collect Allocations button during profiling or select Collect memory allocation and traffic data from start when configuring the profiling session.

  3. In Snapshot Comparison, click View memory allocation.

    View Memory Allocation Two Snapshots
  4. Choose how you want to analyze the data: using grouping by Types, by Methods, or by Call Tree.

Types

Memory Allocation view

The Types view consists of two parts: the objects list and the Back Traces tree.

Objects list

The list shows you the objects allocated on the selected time interval sorted by the object type. Select a particular type to see what functions allocated the objects of this type.

NameDescription
TypeType name.
ObjectsThe number of objects of the same type.
BytesThe overall shallow size of the objects in bytes.

Back Traces

The Back Traces tree shows you all call trees that allocated the objects currently selected in the objects list. The calls are shown from the bottom up: the last call in the call stack is a top node. In other words, Back Traces is the inverted call tree.

You can sort the tree by the amount of allocated memory (Total / Own Bytes) or by the number of allocated objects (Total / Own Objects). To switch the sorting, click the Total / Own ... column header.

The Total / Own ... column shows how much memory (objects) were allocated in a particular call tree (Total) or in a particular call (Own).

For example:

Back Traces

The set_Capacity method allocated 149.80 MB (Own). The method was called from two call stacks:

  • through the AddWithResize method: 142.69 MB

  • and through the EnsureCapacity method: 7.11 MB

Methods

Memory allocation by methods

The Methods view consists of three parts: the methods list, the Back Traces tree, and the sunburst diagram of allocated object types.

Methods list

The list shows you the methods that were called during the selected time interval. Select a particular method to see what object types were allocated by the method as well as method's back traces tree. Note that each method in the list is unique - it represents all calls of this method from all call stacks.

NameDescription
MethodMethod name.
ObjectsThe number of objects allocated by method calls.
BytesThe overall shallow size of the objects in bytes.

Back Traces

The Back Traces tree shows you all call stacks that called the method currently selected in the method list. The calls are shown from the bottom up: the last call in the call stack is a top node. In other words, Back Traces is the inverted call tree.

The Back Traces tree is similar to the one in the Types view.

Call Tree

Memory allocation by call tree

The Call Tree view shows the call tree for the selected time interval. If a call allocated objects, the object types will be shown in the tree below the call.

You can sort the tree by the amount of allocated memory (Total / Own Bytes) or by the number of allocated objects (Total / Own Objects). To switch the sorting, click the Total / Own ... column header.

The Total / Own ... column shows how much memory (objects) were allocated in a particular call tree (Total) or in a particular call (Own).

Last modified: 22 September 2021