I am writing an application entirely on JetpackCompose with MultipleActivity approach. I noticed that all Activities are leaking (except for the first one). I removed all the code in the Activity (except for setContent) - they still leak when changing the configuration. I don't keep links to Activity anywhere. If you comment out
setContent {}
, the leaks disappear, but I can't work with Compose without this function.
Can you tell me what is causing the leaks? How can they be fixed?
All useful info attached to the post.
Виталий Перятин
05/16/2022, 9:09 AM
Compose version is 1.2.0-beta01
Виталий Перятин
05/16/2022, 2:10 PM
collectAsLazyPagingItems
is leaking
l
Leland Richardson [G]
05/17/2022, 11:57 AM
could you file a bug about this?
c
Colton Idle
05/25/2022, 1:37 PM
@py? Didn't you say something about this on twitter by chance?
в
Виталий Перятин
05/25/2022, 1:43 PM
I've found that
Compose
leaks because of multi activity approach, not because of some specific Compose constructions. For example, such simple construction as Column with Text and Image leaks in multi-activity app. But there is no leaks in single-activity approach with Jetpack Compose Navigation.
I've rewritten my app on Jetpack Compose Navigation, and my app has no memory leaks now :)
K 1
p
py
05/25/2022, 3:44 PM
On Twitter I was surfacing a bunch of Compose leaks that seemed to be related to the compose testing rules etc.
This once again points to the compose team needed to set up leakcanary (or similar) on their master.