A MutableState only lasts in a single composition and it is lost in the next composition unless we remember it with
remember
.
👌 4
j
jim
11/17/2020, 2:47 PM
This is no different from normal Kotlin behavior. If you initialize a local variable within a function, that local variable will get garbage collected when the function returns.
❤️ 2
l
louiscad
11/19/2020, 8:36 PM
GC can trigger earlier in theory actually.
It will get garbage collected when no longer needed, which might be earlier than the function returning, since 1.4.20, and that is especially for coroutines where you can have very long running suspending functions.
For Composable functions though, it shouldn't make any difference since they should run very quickly.