Root path
The Root paths panel is used to show the root paths of the instance. A root path is the path of referrers from the selected instance to a root. A root can, for instance, be a static field, a local variable, or a method parameter. If a root cannot be identified, the roots are simply referred to as “<root>.” For a native resource instance, the “wrapper” instances are used as referrers to the instance. If no “wrapper” instances exist, no root paths will be presented.
The root path can be extremely useful for identifying memory leaks. When using the observer pattern or caching instances, it is very easy to forget to remove an observer or to let the cache grow too much. The root path shows why an instance has not been garbage collected.
The shortest path from the selected instance to each root is presented, and the shortest path is shown first. The navigator buttons above the root path can be used to select which root path to show.
At the top of the Root path table is the nearest referrer. The farther a referrer is from the selected instance, the farther that referrer is down the list. At the bottom of the list is the root referrer, which is either presented as the name of a static field, a method, or as “<root>.”
The following data is presented for each referrer:
Namespace
This column shows the namespace name of the instance or type that references the selected instance. If the reference is an unidentified root, this column will contain the text: “<root>.”Name
This column shows the type name of the instance or type that references the selected instance. If the reference is an unidentified root, this column will be empty.Instance/Field/Method
This column shows different information depending on the type of the referrer:If the referrer is an instance, this column shows the instance number of that instance, followed by the name of the field (or item in an array) containing the reference will be appended at the end (e.g., #89,123.m_referenceField or #12,890[5]).
If the referrer is a static field root, this column shows the name of the static field
If the referrer is a local variable or method argument root referrer, the name of the method is presented in this column.
If the referrer is a <GCHandle>, this column will present the instance number of the <GCHandle>, together with any additional GC handle information, such as Weak or Pinned.