Nikhilkumar80
12/09/2021, 8:46 PMprintln(weakStateRef.get())
used to return null
prior to upgrading. Now, it is not cleared when `System.gc()`is called. Is this expected?
data class State(val stateKey: String? = null)
fun func1(newState: State) {
// do nothing
}
fun func2() {
val weakStateRef = WeakReference(State("Foo"))
func1(weakStateRef.get()!!)
System.gc()
println(weakStateRef.get()) // State(stateKey="Foo")
}
udalov
Nikhilkumar80
12/11/2021, 5:49 AM