Skip to content
🤔 Documentation issue? Report it

//leakcanary-repo/shark/HprofHeapGraph

HprofHeapGraph

[jvm]\ class HprofHeapGraph : CloseableHeapGraph

A HeapGraph that reads from an Hprof file indexed by HprofIndex.

Types

Name Summary
Companion [jvm]
object Companion

Functions

Name Summary
close [jvm]
open override fun close()
findClassByName [jvm]
open override fun findClassByName(className: String): HeapObject.HeapClass?
Returns the HeapClass corresponding to the provided className, or null if the class cannot be found.
findHeapDumpIndex [jvm]
open override fun findHeapDumpIndex(objectId: Long): Int
Returns the 1-based index in the heap dump of the object corresponding to the provided objectId, and throws IllegalArgumentException otherwise.
findObjectByHeapDumpIndex [jvm]
open override fun findObjectByHeapDumpIndex(heapDumpIndex: Int): HeapObject
Returns the HeapObject corresponding to the provided heapDumpIndex, and throws IllegalArgumentException if heapDumpIndex is less than 1 or more than objectCount.
findObjectById [jvm]
open override fun findObjectById(objectId: Long): HeapObject
Returns the HeapObject corresponding to the provided objectId, and throws IllegalArgumentException otherwise.
findObjectByIdOrNull [jvm]
open override fun findObjectByIdOrNull(objectId: Long): HeapObject?
Returns the HeapObject corresponding to the provided objectId or null if it cannot be found.
findObjectByIndex [jvm]
open override 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.
lruCacheStats [jvm]
fun lruCacheStats(): String
This is only public so that we can publish stats. Accessing this requires casting HeapGraph to HprofHeapGraph so it’s really not a public API. May change at any time!
objectExists [jvm]
open override fun objectExists(objectId: Long): Boolean
Returns true if the provided objectId exists in the heap dump.

Properties

Name Summary
aliveAndroidServiceObjectIds [jvm]
val HeapGraph.aliveAndroidServiceObjectIds: List<Long>
classCount [jvm]
open override val classCount: Int
classes [jvm]
open override val classes: Sequence<HeapObject.HeapClass>
Sequence of all classes in the heap dump.
context [jvm]
open override val context: GraphContext
In memory store that can be used to store objects this HeapGraph instance.
gcRoots [jvm]
open override 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.
identifierByteSize [jvm]
open override val identifierByteSize: Int
instanceCount [jvm]
open override val instanceCount: Int
instances [jvm]
open override val instances: Sequence<HeapObject.HeapInstance>
Sequence of all instances in the heap dump.
objectArrayCount [jvm]
open override val objectArrayCount: Int
objectArrays [jvm]
open override val objectArrays: Sequence<HeapObject.HeapObjectArray>
Sequence of all object arrays in the heap dump.
objectCount [jvm]
open override val objectCount: Int
objects [jvm]
open override val objects: Sequence<HeapObject>
Sequence of all objects in the heap dump.
primitiveArrayCount [jvm]
open override val primitiveArrayCount: Int
primitiveArrays [jvm]
open override val primitiveArrays: Sequence<HeapObject.HeapPrimitiveArray>
Sequence of all primitive arrays in the heap dump.