# kotlin-native

Daniel Baird

01/27/2022, 2:55 PM
Hi folks. we are seeing some
Attempted to dereference garbage pointer
exceptions in iOS with a few different stack traces, and we are unable to reproduce it. We do a lot of passing objects around between swift and kotlin native, and I don't feel like I have a good handle on how the memory management works in cases where an object originates in kotlin and gets passed into swift, or situations involving lambdas/closures that should be holding on to things. I have a hunch that these issues are related to issues with how we are handling this though. Does anyone know where I can find detailed documentation of how these situations work, or have any info about potential causes of this error when interoping with kotlin native? I have of course read the main kotlin pages like


01/28/2022, 10:51 AM
I had the same issue that was caused by passing an object from Kotlin to Swift and then in Swift transferring it between threads
Solved by freezing the object on Kotlin side

Daniel Baird

01/28/2022, 2:47 PM
Interesting, thanks for the tip.