dotTrace 2024.3 Help

.NET Memory Allocations

The .NET Memory Allocations filter shows you how your application allocated memory to the managed heap. For example, Call Tree shows how much memory (in MB) a particular call has allocated.

Select the .NET Memory Allocations event for analyzing excessive memory traffic and garbage collections. The latter are one of the main reasons of UI freezes as the main thread can be suspended during a GC.

Note that allocation point event is raised only after the size of allocated memory exceeds 100 KB in total. For example, a thread allocates five 50 KB memory blocks during profiling. In such a case, dotTrace will detect only two allocations of 100 KB.

Memory allocation example

After you select the .NET Memory Allocations subject, you can fine-tune the result with the .NET Memory Allocations: Heap filter.

.NET Memory Allocations: Heap

The .NET Memory Allocations: Heap sub-filter is used to show distribution of allocated memory between small and large object heaps. The info about allocations to LOH allows you to evaluate how your application uses large data collections. This can be important for performance analysis as LOH is not automatically compacted and becomes fragmented over time.

As a filter, .NET Memory Allocations: Heap can be used to filter out point events where allocation to a certain heap takes place. For example, if you want to determine methods that allocate memory in LOH, select .NET Memory Allocations in the Events filter and Large Object Heap in .NET Memory Allocations: Heap. The methods will be shown in the Call Stack window in Hotspots.

Memory allocation data

1 Heap name: Small Object Heap or Large Object Heap.

2 The size of objects allocated in the heap.

3 The percentage of size of objects allocated in the heap relative to the total allocated memory.

For example, your application has two threads: Thread#1 and Thread#2. During profiling, Thread#1 allocated 8 MB to SOH and 1 MB to LOH. Thread#2 allocated 1 MB to LOH. The Events filter for these two threads will look like follows:

...
.NET Memory Allocations 10 MB
...

The .NET Memory Allocations: Heap filter will look like follows:

Small Object Heap 8 MB 80.00%
Large Object Heap 2 MB 20.00%

To apply the .NET Memory Allocations: Heap filter

  • Select the desired heap(s) in the filter.

    After you select a heap, other filters will show only the point events where allocation to the selected heap took place. For example, Hotspots in the Call Stack window will show the list of methods that allocated objects in the heap.

    Memory allocation heap

.NET Memory Allocations: Type

The .NET Memory Allocations: Type sub-filter is used to show distribution of allocated memory between objects of a certain type. This info may help you to identify types of allocated objects on a selected timeframe.

As a filter, .NET Memory Allocations: Type can be used to filter out point events where objects of a certain type are allocated. For example, if you want to determine methods that allocate strings, select .NET Memory Allocations in the Events filter and System.String in .NET Memory Allocations: Type. The methods will be shown in the Call Stack window in Hotspots.

Memory allocation type

1 Type name.

2 The size of objects.

3 The percentage of size of objects of a certain type relative to the total allocated memory.

To apply the .NET Memory Allocations: Type filter

  • Select the desired type(s) in the filter.

    After you select a type, other filters will show only the point events where allocation of objects of this type took place. For example, Hotspots in the Call Stack window will show the list of methods that allocated objects of the selected type.

    Memory allocation type
Last modified: 26 May 2024