Do we have to manage the destruction of composable...
# compose
b
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
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
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
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
oo gotcha thanks~
a
we still have some API cleanup to do around this for sure 🙂