https://kotlinlang.org logo
#compose
Title
# compose
b

Bryan Lee

12/26/2019, 7:10 PM
Do we have to manage the destruction of composable views ourselves as of now? I consistently get OutOfMemoryError after opening a list of items X amount of times
a

Adam Powell

12/26/2019, 7:15 PM
unfortunately for now yes, depending on how you constructed things. If you do a
container.setContent {}
when you dispose of a compose subhierarchy it should clear things out. I think the activity variant does this automatically but I don't recall
(that's specifically a
setContent
with an empty content block)
b

Bryan Lee

12/26/2019, 8:04 PM
Sorry, could you elaborate on how to dispose of a compose sub-hierarchy? Where would I do this? one of the activities/fragments lifecycle functions?
a

Adam Powell

12/26/2019, 8:09 PM
if you ctrl+click into the source for the
setContent
extensions you can see what a bunch of them do under the hood to build the composition; the dispose helpers all basically just recompose with empty content to clear things
b

Bryan Lee

12/26/2019, 8:28 PM
oo gotcha thanks~
a

Adam Powell

12/26/2019, 8:32 PM
we still have some API cleanup to do around this for sure 🙂
6 Views