Anybody knows how kotlin-native objects are garbag...
# kotlin-native
m
Anybody knows how kotlin-native objects are garbage collected? This sample manages to crash the app
Copy code
val array = Random.nextBytes(1000000)
for (i in 0..10000) {
    array.usePinned {
        NSData.create(bytes = it.addressOf(0), length = array.size.convert())
    }
}
adding
GC.collect
call inside loop does nothing, because as I understand
NSData
objects are not allocated in heap?
m
Thanks, but tried
autoreleasepool
before and it didn't help sadly.
autoreleasepool
with
kotlin.native.binary.objcDisposeOnMain=false
helped though, thanks!
👍 2
Does anybody know a youtrack issue I could follow for this? (assuming this is even possible to solve)