The Disposed Objects view tracks whether there are existing disposed instances.
In other words, this analysis shows all instances that have been disposed without being properly garbage collected.
In most of the scenarios this could be a potential memory leak.
To see the disposed objects in the Type List, enable them by pressing the
Disposed Leaks button
() in the ribbon. Then, you will be able to distinguish them by the icon in the type list:
How to decide if the disposed objects are indications for memory leaks or not
Potential memory leaks:
Other reasons for Disposed Objects to exist:
An instance can exist after dispose if it is being referenced by other, still living objects (for example: local variables).
To check if this applies to your case, perform a Force GC and then Get Snapshot again.
The above disposed instances should not appear in the Disposed Objects anymore.
As disposed instances should no longer be used, if they still exist, you should check if something else is referencing them.
Click on Instances or simply double click the desired object.
In the Instances list you will be able to check the Root Paths of each instance, by clicking the button in the ribbon.
If you notice something, holding your instance, it is very likely to be looking at a memory leak.
If the instance is part of a pool, when disposed it is actually being recycled.
This technique is used to avoid the expensive creations of the instance, as instead of this it could be reused.
In this technique, it is normal for the instance to exist after being disposed.
Getting started with the Disposed Objects view
The Just My Types toggle button filters out all types which are not user code.
You can control which assemblies are considered user code in the Assembly List view.
By double clicking on a type or by clicking the Instances icon in the ribbon,
you can open a new tab with the Instances List view to examine all objects of the selected class.
Each row of the table holds the following information:
- Class Name - fully qualified name of the type.
- Instances - number of alive instances of this type at the moment the snapshot was taken.
- Total Retained Size - the sum of the retained sizes of all instances.