Skip to content
🤔 Documentation issue? Report it

//leakcanary-repo/leakcanary/KeyedWeakReference

KeyedWeakReference

[jvm]\ class KeyedWeakReference(referent: Any, val key: String, val description: String, val watchUptimeMillis: Long, referenceQueue: ReferenceQueue<Any>) : WeakReference<Any>

A weak reference used by ReferenceQueueRetainedObjectTracker to determine which objects become weakly reachable and which don’t. ReferenceQueueRetainedObjectTracker uses key to keep track of KeyedWeakReference instances that haven’t made it into the associated ReferenceQueue yet.

heapDumpUptimeMillis should be set with the current time from UptimeClock.uptime right before dumping the heap, so that we can later determine how long an object was retained.

Constructors

KeyedWeakReference [jvm]
constructor(referent: Any, key: String, description: String, watchUptimeMillis: Long, referenceQueue: ReferenceQueue<Any>)

Types

Name Summary
Companion [jvm]
object Companion

Functions

Name Summary
clear [jvm]
open override fun clear()
enqueue [jvm]
open fun enqueue(): Boolean
get [jvm]
open override fun get(): Any?
getAndLeakReferent [jvm]
fun getAndLeakReferent(): Any?
Same as WeakReference.get but does not trigger an intentional crash.
refersTo [jvm]
fun refersTo(p0: Any): Boolean

Properties

Name Summary
description [jvm]
val description: String
key [jvm]
val key: String
retained [jvm]
val retained: Boolean
retainedUptimeMillis [jvm]
@Volatile
var retainedUptimeMillis: Long
Time at which the associated object (referent) was considered retained, or -1 if it hasn’t been yet.
watchUptimeMillis [jvm]
val watchUptimeMillis: Long