Closed Alex009 closed 1 year ago
i think problem is reference cycle with keyboard observer
as i know for K/N difficult to understand cycles between Kotlin & ObjC boundaries
Had the same problem. I thought that was my fault of leaked reference somewhere :)
I have a workaround for this. I just set the ComposeUIViewController.view
to an empty UIView.
But it not solved my original memory leaks. Somewhy lot of IOSurface is stuck in the memory:
Do you experience the same?
The problem is pinned down and is related to GC. In this particular case it's resolved via using new Kotlin language feature to manually release native API reference counted objects when their lifetime is critical for correct usage of API (CAMetalDrawable is living for too long and holds IOSurface memory). The latest possible moment the fix arrives is release associated with Kotlin 1.9.0.
I found more sources of this leak caused by interaction of GC and ARC-managed memory, to be resolved later
The leak of ComposeWindow itself (but not all associated resources) is fixed in this PR
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.
Describe the bug I embed
ComposeUIViewController
to native iOS navigation. When i navigate back currentComposeUIViewController
should release memory, but it's not.Affected platforms
Versions
To Reproduce
Simulate memory warning
on simulator - you see in logs that manyComposeUIViewController
got this warningExpected behavior
ComposeUIViewController
should release memory when it's not used by app.Screenshots
Additional context Add any other context about the problem here.