Is there a way to bind native object lifetime to a...
# kotlin-native
d
Is there a way to bind native object lifetime to a kotlin object?
o
No, but using weak reference you may know, that Kotlin object is gone
d
Thank you. Although I don’t think weak reference with making the following code simpler.
Copy code
class Box {
    private val arena = Arena()
    
    fun foo() {
        arena.alloc<timespec>()
        arena.alloc<timespec>()
    }
    
    fun clear() {
        arena.clear()
    }
}
Would be great to get rid of the
box.clear()
.