Skip to content
🤔 Documentation issue? Report it

//leakcanary-repo/shark/ChainingInstanceReferenceReader

ChainingInstanceReferenceReader

[jvm]\ class ChainingInstanceReferenceReader(virtualRefReaders: List<ChainingInstanceReferenceReader.VirtualInstanceReferenceReader>, flatteningInstanceReader: FlatteningPartitionedInstanceReferenceReader?, fieldRefReader: FieldInstanceReferenceReader) : ReferenceReader<HeapObject.HeapInstance>

A ReferenceReader that first delegates expanding to virtualRefReaders in order until one matches (or none), and then always proceeds with fieldRefReader. This means any synthetic ref will be on the shortest path, but we still explore the entire data structure so that we correctly track which objects have been visited and correctly compute dominators and retained size.

Constructors

ChainingInstanceReferenceReader [jvm]
constructor(virtualRefReaders: List<ChainingInstanceReferenceReader.VirtualInstanceReferenceReader>, flatteningInstanceReader: FlatteningPartitionedInstanceReferenceReader?, fieldRefReader: FieldInstanceReferenceReader)

Types

Name Summary
VirtualInstanceReferenceReader [jvm]
interface VirtualInstanceReferenceReader : ReferenceReader<HeapObject.HeapInstance>
Same as ReferenceReader but read is only invoked when matches returns true. matches should return false if this VirtualInstanceReferenceReader implementation isn’t able to expand the provided instance, in which case ChainingInstanceReferenceReader will delegate to the next VirtualInstanceReferenceReader implementation.

Functions

Name Summary
read [jvm]
open override fun read(source: HeapObject.HeapInstance): Sequence<Reference>
Returns the sequences of non null outgoing references from source. Outgoing refs can be actual JVM references or they can be virtual references when simplifying known data structures.