Fix missing dealloc hooks on object freed by cycle collector. (#1487)

This commit is contained in:
Nikolay Igotti
2018-04-12 18:40:07 +03:00
committed by GitHub
parent 1aabf3697d
commit c5c2a080d8
4 changed files with 42 additions and 34 deletions
+5
View File
@@ -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']
+1 -1
View File
@@ -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")
}