I'd like to get some clarification on AtomicRefere...
# kotlin-native
k
I'd like to get some clarification on AtomicReference and memory leaks. In the code comments it says we should null out references to make sure they don't result in leaks, but it seems like they won't always result in leaks. Curious about details. The atomicLazy comment seems to imply cyclic references https://github.com/JetBrains/kotlin-native/blob/master/runtime/src/main/kotlin/kotlin/native/concurrent/Lazy.kt#L115. The Atomics.kt comment just says you should null them out without much detail. While I'll also try to construct shared structures to null out data, if the problematic situations were clear, it would be easier to not have to do that. Thoughts?
o
generally, we carefully examine for cycles in regular lazy (see https://github.com/JetBrains/kotlin-native/blob/8fd7970119b24b7dd467e12a20e34e747a3cb0ed/runtime/src/main/kotlin/kotlin/native/concurrent/Lazy.kt#L36) but using pure AtomicReference could indeed lead to leaks