ursus
10/14/2026, 8:23 PMAnimatedContent as to get nice animated transition switch
But just for funsies I wanted to check if the switched-away instances do get GC'ed as expected, and turns out they don't (?).
And when I switch AnimatedContent to simple when then it's all fine.
So I dumped heap and I'm still seeing my objects referenced via some compose machinery, way after the transition happened (like 10 seconds)
Is there a known memory leak in latest AnimatedContent ? The code is bog standard
val appState by appRootStateHelper.state.collectAsState()
AnimatedContent(
targetState = appState,
) {
when (it) {
is AppRootState.Subscriber -> {
SubscriberRoot(it.subscriberGraph)
}
...
}
}
Or is this somehow weirdly expected? That previous states are kept in Transition forever??shikasd
10/15/2026, 2:57 PMursus
10/15/2026, 3:22 PMshikasd
10/15/2026, 3:50 PMursus
10/15/2026, 6:10 PMursus
10/15/2026, 6:10 PMursus
10/15/2026, 7:30 PMretain -ed objects subar relative to ViewModel which doesnt seem to have this bug; and I don't want to build my presenter api on top of androidx ViewModel if I can help itshikasd
10/16/2026, 9:03 PMursus
10/16/2026, 9:03 PM