Skip to content
🤔 Documentation issue? Report it

//leakcanary-repo/shark/ObjectReporter

ObjectReporter

[jvm]\ class ObjectReporter(val heapObject: HeapObject)

Enables ObjectInspector implementations to provide insights on heapObject, which is an object (class, instance or array) found in the heap.

A given ObjectReporter only maps to one object in the heap, but is shared to many ObjectInspector implementations and accumulates insights.

Constructors

ObjectReporter [jvm]
constructor(heapObject: HeapObject)

Functions

Name Summary
whenInstanceOf [jvm]
fun whenInstanceOf(expectedClassName: String, block: ObjectReporter.(HeapObject.HeapInstance) -> Unit)
Runs block if ObjectReporter.heapObject is an instance of expectedClassName.
[jvm]
fun whenInstanceOf(expectedClass: KClass<out Any>, block: ObjectReporter.(HeapObject.HeapInstance) -> Unit)
Runs block if ObjectReporter.heapObject is an instance of expectedClass.

Properties

Name Summary
heapObject [jvm]
val heapObject: HeapObject
labels [jvm]
val labels: LinkedHashSet<String>
Labels that will be visible on the corresponding heapObject in the leak trace.
leakingReasons [jvm]
val leakingReasons: MutableSet<String>
Reasons for which this object is expected to be unreachable (ie it’s leaking).
notLeakingReasons [jvm]
val notLeakingReasons: MutableSet<String>
Reasons for which this object is expected to be reachable (ie it’s not leaking).