Hey, I am trying to implement a simple use case, I have constant defined in KMP and then use it from iOS Swift project (KMP code embedded as a Framework). In short whenever I try to use that constant in anything else than main thread I can see memory leak captured in the Xcode leak instruments.
val constant1 = "This leaks"
fun constant2() = "This also leaks"
object Constant3 {
const val constant3 = "Not better."
}
class Constant4 {
val constant4 = "Ima leak some more..."
}
and an example of it being used
DispatchQueue.global(qos: .background).async {
let value = ConstantKt.constant1
}
And just to note - @SharedImmutable
or @ThreadLocal
won’t help.
Any ideas?