Skip to content
🤔 Documentation issue? Report it

//leakcanary-repo/shark/HeapObject

HeapObject

sealed class HeapObject

An object in the heap dump.

Inheritors

HeapClass
HeapInstance
HeapObjectArray
HeapPrimitiveArray

Types

Name Summary
Companion [jvm]
object Companion
HeapClass [jvm]
class HeapClass : HeapObject
A class in the heap dump.
HeapInstance [jvm]
class HeapInstance : HeapObject
An instance in the heap dump.
HeapObjectArray [jvm]
class HeapObjectArray : HeapObject
An object array in the heap dump.
HeapPrimitiveArray [jvm]
class HeapPrimitiveArray : HeapObject
A primitive array in the heap dump.

Functions

Name Summary
readRecord [jvm]
abstract fun readRecord(): HprofRecord.HeapDumpRecord.ObjectRecord
Reads and returns the underlying ObjectRecord.

Properties

Name Summary
asClass [jvm]
val asClass: HeapObject.HeapClass?
This HeapObject as a HeapClass if it is one, or null otherwise
asInstance [jvm]
val asInstance: HeapObject.HeapInstance?
This HeapObject as a HeapInstance if it is one, or null otherwise
asObjectArray [jvm]
val asObjectArray: HeapObject.HeapObjectArray?
This HeapObject as a HeapObjectArray if it is one, or null otherwise
asPrimitiveArray [jvm]
val asPrimitiveArray: HeapObject.HeapPrimitiveArray?
This HeapObject as a HeapPrimitiveArray if it is one, or null otherwise
graph [jvm]
abstract val graph: HeapGraph
The graph of objects in the heap, which you can use to navigate the heap.
objectId [jvm]
abstract val objectId: Long
The heap identifier of this object.
objectIndex [jvm]
abstract val objectIndex: Int
An positive object index that’s specific to how Shark stores objects in memory. The index starts at 0 and ends at HeapGraph.objectCount - 1. There are no gaps, every index value corresponds to an object. Classes are first, then instances, then object arrays then primitive arrays.
positiveObjectId [jvm]
val positiveObjectId: Long
objectId masked to be a positive unique identifier, as reported in Android Studio.
recordSize [jvm]
abstract val recordSize: Int
The total byte size for the record of this object in the heap dump.