Heap Walker Reference View - Outgoing References


  The outgoing references view shows instances in the current object set. Each instance can be opened to show outgoing references as well as primitive data.

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 consists of three parts:
  • Field name
    The field name of the object in the parent node that holds the referenced object
  • Reference icon
    The reference icon separates the holder from the referenced object. The icon is one of
    • A regular reference.
    • 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
  • Referenced object
    This is the object referenced by the outgoing reference. Direct child references below this node refer to this object.

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.

  The [Apply filter ...] menu at the top of the view allows you to filter the current object set. Filters are always applied to the top-level objects, i.e. the objects that are actually part of the current object set.

When you open outgoing references and select a reference or a primitive value, the filter uses the selected node as the criterion. Top-level objects that do not have a path of outgoing references such as the selected path, are discarded by the filter.

If a non-primitive value is selected, and you are profiling in live mode, you can apply a filter with a code snippet. In the script, you can use the object parameter to write your filter expression. The objects that are passed to your script are on the same level as the one that you have selected. Return true if the associated top-level object should be retained, otherwise it will be discarded. If you want to filter repeatedly with the same expression, don't forget the script history feature of the script editor.

If you have selected a top-level object, the parameter is only typed if all objects in the current object set have the same class. Also, in that case the result is equivalent to running the custom filter inspection on the current object set.

Alternatively, you can apply a filter by restricting the selected value. For primitive values, you can restrict the value by settings bounds or testing for equality. For object references, there are 3 different restrictions:

  • Null references
    If you have selected a reference which is not at the top level, you can filter for all references that are null or all references that are non-null.
  • Type
    You can restrict the selected references to a particular type and its derived classes. Optionally, you can switch off the derived classes matching and just test for the concrete class. For HPROF and PHD snapshots, derived classes matching is not available.
  • toString() value
    If you are profiling in live mode, you can perform a match against the result of the toString() method of the selected objects. All text fields where you can enter values have a drop down list with a history that is persistent across sessions. For snapshots, this only works on instances of java.lang.String.
  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, 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.
  • Selected java.lang.Class Objects
    The new object set will consist of all java.lang.Class objects of the selected instances.
  • 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.
  • Loaded Instances By Selected Class Loader
    This option is only enabled if you select one or more instances of java.lang.ClassLoader. A new object set will be created that contains the objects whose classes have been loaded by the selected class loaders.
  • Retained Objects
    A new object set will be created that contains all objects that would be garbage collected if the selected objects did not exist on the heap. This always includes the selected objects.

After your selection, the view helper dialog will assist you in choosing the appropriate view for the new object set.