11/11/2021, 9:11 AM
Hi, I am currently doing performance benchmark of a KMM project. Although there were no memory leaks in the Android App for one of the flows, But there are a plenty of leaks in the iOS app. After implementing one of the solutions mention in this issue (ie. calling
when screens are getting closed) the leaks exist. I'm sharing screenshots for some of the memory leaks. Has anyone else seen these kind of leaks before?

Carson Holzheimer

11/11/2021, 12:31 PM
I think to confirm a memory leak we would need a reproducable sample. I'm no expert, so can't infer a memory leak exists from the stack traces you provided


11/11/2021, 3:38 PM
I looked at the sample app in the ticket (briefly) and there's a lot going on. I think it would be easier to isolate an individual memory leak, and also describe how you're finding these leaks. Is this using Xcode profiler? If you can't publish the code, is there at least some example of what you're doing? How you're calling the code?
I'd then be curious to also try this out with the newer memory model, as there's always been an issue with AtomicReference.


11/11/2021, 7:01 PM
Yes, I have used Instruments to find the memory leaks. Apparently I can't publish the code, But I will try to find a way to reproduce it in a sample app. Also, I didn't tried this out with the new memory model.
Hi, I am sharing a sample project where I have been able to reproduce some of the leaks. Alongside that, I am attaching a video with the leaks being detected in the Instruments. @kpgalligan @Carson Holzheimer

Alex Acosta

11/07/2022, 9:20 PM
I am also able to reproduce this, simple network calls are creating leaks. Kotlin: 1.7.20 Ktor: 2.1.3 Coroutines: 1.6.4 @Angad did you find any solution to this?