shark-graph / shark / HeapGraph

HeapGraph

interface HeapGraph

Enables navigation through the heap graph of objects.

Properties

NameSummary
classCountabstract val classCount: Int
classesabstract val classes: Sequence<HeapObject.HeapClass>
Sequence of all classes in the heap dump.
contextabstract val context: GraphContext
In memory store that can be used to store objects this HeapGraph instance.
gcRootsabstract val gcRoots: List<GcRoot>
All GC roots which type matches types known to this heap graph and which point to non null references. You can retrieve the object that a GC Root points to by calling findObjectById with GcRoot.id, however you need to first check that objectExists returns true because GC roots can point to objects that don't exist in the heap dump.
identifierByteSizeabstract val identifierByteSize: Int
instanceCountabstract val instanceCount: Int
instancesabstract val instances: Sequence<HeapObject.HeapInstance>
Sequence of all instances in the heap dump.
objectArrayCountabstract val objectArrayCount: Int
objectArraysabstract val objectArrays: Sequence<HeapObject.HeapObjectArray>
Sequence of all object arrays in the heap dump.
objectCountabstract val objectCount: Int
objectsabstract val objects: Sequence<HeapObject>
Sequence of all objects in the heap dump.
primitiveArrayCountabstract val primitiveArrayCount: Int
primitiveArraysabstract val primitiveArrays: Sequence<HeapObject.HeapPrimitiveArray>
Sequence of all primitive arrays in the heap dump.

Functions

NameSummary
findClassByNameabstract fun findClassByName(className: String): HeapObject.HeapClass?
Returns the HeapClass corresponding to the provided className, or null if the class cannot be found.
findObjectByIdabstract fun findObjectById(objectId: Long): HeapObject
Returns the HeapObject corresponding to the provided objectId, and throws IllegalArgumentException otherwise.
findObjectByIdOrNullabstract fun findObjectByIdOrNull(objectId: Long): HeapObject?
Returns the HeapObject corresponding to the provided objectId or null if it cannot be found.
findObjectByIndexabstract fun findObjectByIndex(objectIndex: Int): HeapObject
Returns the HeapObject corresponding to the provided objectIndex, and throws IllegalArgumentException if objectIndex is less than 0 or more than objectCount - 1.
objectExistsabstract fun objectExists(objectId: Long): Boolean
Returns true if the provided objectId exists in the heap dump.

Inheritors

NameSummary
CloseableHeapGraphinterface CloseableHeapGraph : HeapGraph, Closeable
A HeapGraph that should be closed after being used.