## Heap Walker Reference View - Incoming References |

| The incoming references view shows instances in the current object set. Each instance can be opened to show incoming references. The table only concerns the top-level instances and shows the following sortable columns: Retained size The amount of memory that would be freed if the object were removed from the heap. Shallow size The amount of memory directly used by the object. Allocation time The time when the object was allocated. This information is only available if allocation time recording is enabled in the profiling settings. The number of top-level objects that are shown is limited to 100 by default. You can add more objects with the hyperlink after the last row in the table. The default number of objects can be adjusted in the view settings.

| 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.

| To check why an instance is not garbage collected, you can select it and click the [Show paths to GC root] button at the top of the view. The options dialog allows you to configure the way JProfiler performs the search. After the search has completed, the tree is expanded up to the garbage collector roots that were found. If the object is not referenced by a garbage collector root, a message box will be displayed. Note that this case is only possible if the "Remove unreferenced and weakly referenced objects" option in the heap walker option dialog is unchecked. Newly expanded nodes on the path to the GC root have a red reference icon. To highlight the found path without any distractions, no sibling references are shown on that level. To show all sibling references, you can either choose the Show all incoming references action from the context menu or View menu or collapse and expand the parent node.

| To analyze both incoming and outgoing references and to explore the relationship between objects of interest, use the [Show in graph] button at the top of the view. The selected instances will be then be added to the graph. The graph is not cleared when you choose a new object set or go back in the history, so you can add objects from different object sets to the graph.

| If you're profiling in live mode with a 1.5 JVM or higher, the [Show toString() values] button at the top of the view is active. When you click it, JProfiler invokes `toString()` on all expanded references in the view and shows the results. If you open more references or add more references with the hyperlink at the bottom of the table, those objects will not have their `toString()` values displayed. You will have to click the button again in order to show the missing values. The reason why this operation is not performed automatically is that calculating toString() values is an expensive operation that invokes Java code in the profiled JVM and may even have unwanted side effects in buggy implementations.

| To add a selection step from this view you can select one or multiple objects and click the [Use ...] button above the graph and choose in the popup menu. Multiple objects are selected by keeping the SHIFT or CTRL keys pressed during selection. The following selection modes are available: Selected Objects A new object set will be created that contains only the selected instances. Exclusively Referenced Objects A new object set will be created that contains all objects that would be garbage collected if the selected objects did not exist. Items in Selected Collection This option is only enabled if you select an array of objects or a standard collection from the `java.util` package. A new object set will be created that contains the objects in the array or collection. If you select a map collection, you are prompted whether you want to include the key objects as well. After your selection, the view helper dialog will assist you in choosing the appropriate view for the new object set.