Heap Walker Reference View - Reference Graph

## Heap Walker Reference View - Reference Graph |

The reference graph list is one of the view modes in the reference view of the heap walker.

| The reference graph shows the incoming and outgoing references of all instances of classes and arrays which are contained in the current object set. There is always one instance visible at a time. Above the upper right corner of the table, navigation controls allow to move back and forth through all the instances or arrays in the current object set. The instance navigation is linked with the data view of the heap walker to allow you to easily switch back and forth between these views while keeping the focus on the same object. No specific view settings apply to the reference graph.

| The order of the instances in the object set can be adjusted to unsorted The objects are in a random order. This is the default setting. sorted by shallow size Objects with a larger shallow size are displayed first. sorted by deep size Objects with a larger deep size are displayed first. sorted by exclusive deep size Objects with a larger exclusive deep size are displayed first. sorted by allocation time (oldest first) Objects with a greater age are displayed first. The "Record object allocation times" feature has to be activated on the "Memory Profiling" tab of the profiling settings dialog, otherwise this sort mode is not available and a warning message is displayed. This sorting only works for recorded objects. Unrecorded objects are appended to the end of the sorted set. sorted by allocation time (newest first) Like the above sort mode, only that objects with a smaller age are displayed first. Please see the key concepts of the heap walker for an explanation of the different size types. Sorting can take a few seconds, depending on the size of the heap. The exclusive deep size sort mode is the computationally most expensive one. A progress dialog is shown while the objects are sorted. If the operation takes longer than the configured timeout, the operation will return with a report about the amount of work done. In that case, there will be a partial sorting. After changing the sort order, the displayed index is set to one.

| The references graph has the following properties: Instances are painted as rectangles with the class name of the instance written inside the rectangle. References are painted as arrows, the arrowhead points from the holder toward the holdee. If you move the mouse over the reference, a tooltip window will be displayed that shows details for the particular reference. The current instance has a violet background. In the current instance, the following additional information is displayed: shallow size deep size exclusive deep size allocation time, if the "Record object allocation times" feature is activated on the "Memory Profiling" tab of the profiling settings dialog Please see the key concepts of the heap walker for an explanation of the different size types. Garbage collector roots have a red background. 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 Classes (objects of `java.lang.Class`) have a yellow background. 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 not 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 set of live instances that reference a yellow class object (see above) has a green background. 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). String values are shown directly in the `java.lang.String` instance rectangle. By default, the reference graph only shows the direct incoming and outgoing references of the current instance. You can expand the graph by double clicking on any object. This will expand either the direct incoming or the outgoing references for that object, depending on the direction you're moving in. Selective actions for expanding the graph are available in the view-specific toolbar and the context menu: Show outgoing references Show incoming references If applicable, an instance has plus and minus signs at the left and the right side to show or hide incoming and outgoing references. The controls at the left side are for incoming, the controls at the right side for outgoing references. The plus signs have the same effect as the Show outgoing references and the Show incoming references actions. A minus sign hides all outgoing references and all objects that are not connected to the central instance. This can have the effect that the object on which you click the minus sign is hidden as well. Additionally, the plus and minus signs give you the following indications: plus sign There might be references to display. You have not yet tried to expand them. minus sign You have expanded all references, there are no more references to expand. no sign You have tried to expand references, but there were none. To reset the graph to its original state, you can choose Reset graph from the context menu. The reference graph offers a number of navigation and zoom options.

| To check why an instance is not garbage collected, you can select it and use the Show paths to GC root button in the view-specific toolbar or the corresponding entry in the context menu. A dialog will ask you whether to search for a single garbage collector root or for all roots. After that, the paths to root are searched. This is a computationally expensive operation and can take some time. A progress dialog is shown while the paths to root are calculated. If the operation takes longer than the configured timeout, the operation will return with a report about the amount of work done. In that case, all garbage collector roots found so far will be displayed. 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. Otherwise the graph is then expanded up to the garbage collector roots that were found. The garbage collector roots themselves are displayed with a red background.

| There are four layout strategies for showing the reference graph which can be chosen by clicking on in the toolbar or choosing the layout strategy from the context menu. Hierarchic layout Standard layout that tries to layout the graph from left to right. This is suitable for most purposes. Hierarchic layout (Top to Bottom) Like above, only that the layout axis is vertical. This can be suitable for viewing long chains of references. Organic layout Layout that tries to layout instances for optimal proximity. This layout is suitable for complex situations and can visualize clusters. Orthogonal layout Layout that tries to layout instances on a rectangular grid. This layout is suitable if your objects form a matrix.

| 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 selected objects in the popup menu. There is a corresponding entry in the context menu. A new object set will be created that contains only the selected instances. Multiple objects are selected by keeping the SHIFT key pressed during selection. select an array of objects or a standard collection from the `java.util` package and click the [Use ...] button above the graph and choose items in selected collection in the popup menu. There is a corresponding entry in the context menu. 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 if 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.