Fix missing dealloc hooks on object freed by cycle collector. (#1487)
This commit is contained in:
@@ -2081,6 +2081,11 @@ task memory_weak0(type: RunKonanTest) {
|
||||
source = "runtime/memory/weak0.kt"
|
||||
}
|
||||
|
||||
task memory_weak1(type: RunKonanTest) {
|
||||
goldValue = "OK\n"
|
||||
source = "runtime/memory/weak1.kt"
|
||||
}
|
||||
|
||||
task mpp1(type: RunStandaloneKonanTest) {
|
||||
source = "codegen/mpp/mpp1.kt"
|
||||
flags = ['-tr', '-Xmulti-platform']
|
||||
|
||||
@@ -50,7 +50,7 @@ fun run() {
|
||||
// hashCode (directly):
|
||||
if (foo.hashCode() == foo.hash().let { it.toInt() xor (it shr 32).toInt() }) {
|
||||
// toString (virtually):
|
||||
println(listOf(foo, pair).map { it.toString() }.min() == foo.description())
|
||||
println(map.keys.map { it.toString() }.min() == foo.description())
|
||||
}
|
||||
|
||||
println(globalString)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package runtime.memory.weak1
|
||||
|
||||
import kotlin.test.*
|
||||
import konan.ref.*
|
||||
|
||||
class Node(var next: Node?)
|
||||
|
||||
@Test fun runTest() {
|
||||
val node1 = Node(null)
|
||||
val node2 = Node(node1)
|
||||
node1.next = node2
|
||||
|
||||
konan.ref.WeakReference(node1)
|
||||
println("OK")
|
||||
}
|
||||
Reference in New Issue
Block a user