|
Each reference node has one or two icons. The first icon is one of
-
a regular reference.
-
a reference expanded by the search to garbage collector root (see below).
-
a reference from an object that is
already present as an ancestor node. This indicates a reference cycle. Cycles are more conveniently analyzed
in the graph view
The second icon is either not present or one of
-
a reference from a class.
In most circumstances, classes are the last step on the path to the GC root that you are interested in.
Classes are not garbage collector roots, but in all situations where no custom classloaders
are used it is appropriate and easier to treat them as such. This is JProfiler's default
mode when searching for garbage collector roots, you can change this in the
path to root options dialog.
Class objects have references to
-
all implemented interfaces
-
their classloader unless they were loaded by the bootstrap classloader
-
all references in their constant pool
Note that class objects have no reference to their super class.
Classes are garbage collected together with their classloader when
-
there is no class loaded by that classloader that has any live instances
-
the classloader is unreferenced except by its classes (this is a JVM level reference and not visible
in the source of java.lang.Class).
-
None of the java.lang.Class objects is referenced except by the classloader
and other classes of that classloader.
-
a garbage collector root.
A garbage collector root is an entity in the JVM that itself is not garbage collected and pins other objects or classes.
There are the following types of garbage collector roots:
-
JNI references
Native code can request references from the JNI (local or global)
-
stack
Local variables all current stack frames
-
sticky class
The JVM itself can flag certain classes as non-garbage collectable
-
thread block
Live threads are not garbage collected
-
monitor used
A monitor that is held by someone cannot be garbage collected
-
other GC root
The JVM can pin objects by attaching this unspecified GC root to them
For classes there is a special condition that prevents garbage collection:
Since each instance has an implicit reference to its class, any live instance prevents a class
from being garbage collected. This construct groups all such instances for reasons of conciseness.
In this way you can also select all instances of a specific class (rather than a specific class name).
Each object is optionally annotated with an object ID. With this ID, you can check whether two objects are
the same or not. The display of IDs can be switched off the the context menu and the
view settings.
|