Interface HeapObject

All Known Subinterfaces:
ClassObject, Instance, PrimitiveArray, StringInstance

public interface HeapObject
Represents an object from a heap dump. Provides information regarding the object's identity, size, associated class description, and its relationship with other objects in the heap.

You can cast this object to its subinterfaces Instance, StringInstance, PrimitiveArray and ClassObject to get further specific data. You can determine the object kind with the ClassDescriptor provided by the classDescriptor() method. For PHD snapshots, only HeapObject and ClassObject is available.

  • Method Details

    • id

      long id()
      Retrieves a unique identifier of the object.
      Returns:
      a long value representing the unique identifier
    • size

      long size()
      Retrieves the shallow size of the object.
      Returns:
      the size as a long value.
    • classDescriptor

      @NotNull ClassDescriptor classDescriptor()
      Retrieves the class descriptor associated with this heap object. The class descriptor contains metadata about the object's type, including its name, hierarchy, and fields.
      Returns:
      the ClassDescriptor instance representing the class of this heap object, never null.
    • referencedObjects

      @NotNull Collection<HeapObject> referencedObjects()
      Retrieves all objects referenced directly by this heap object. The references include field values, array values or other class specific referenced objects for a ClassObject.
      Returns:
      a collection of HeapObject instances that are directly referenced by this object. The collection is never null but may be empty if no objects are referenced.
    • referencingObjects

      @NotNull Collection<HeapObject> referencingObjects()
      Retrieves all objects that directly reference this heap object.
      Returns:
      a collection of HeapObject instances that reference this object. The collection is never null but may be empty if no objects reference this heap object.