//leakcanary-object-watcher/leakcanary/KeyedWeakReference

KeyedWeakReference

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

A weak reference used by ObjectWatcher to determine which objects become weakly reachable and which don‘t. ObjectWatcher 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 Clock.uptimeMillis right before dumping the heap, so that we can later determine how long an object was retained.

Constructors

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

Types

NameSummary
Companion[jvm]
object Companion

Functions

NameSummary
clear[jvm]
open override fun clear()
enqueue[jvm]
open fun enqueue(): Boolean
get[jvm]
open fun get(): Any?
isEnqueued[jvm]
open fun isEnqueued(): Boolean

Properties

NameSummary
description[jvm]
val description: String
key[jvm]
val key: String
next[jvm]
val next: Reference<Any>
queue[jvm]
val queue: ReferenceQueue<in Any>
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