2.5.17
https://codesandbox.io/s/4k43rylw0
Load the reproducer and take a memory heap snapshot. Searching the heap you will find 4 VueComponents (App, Container, Child, Async Child)
Click the Destroy button. This toggles a v-if which will remove Child component and thus AsyncChild component as well.
After destroying Child component, the component and it's asynchronously loaded child component should be destroyed and the memory freed up.
Vue is holding on to a context reference which is preventing these components from being garbage collected
This is happening due to the resolve-async-component logic located here: https://github.com/vuejs/vue/blob/52719ccab8fccffbdf497b96d3731dc86f04c1ce/src/core/vdom/helpers/resolve-async-component.js#L57-L68
In the forceRender function on line 64, after calling $forceUpdate, the contexts array should be cleared to free up those references so that the components will be able to be garbage collected at a later point in time
I can submit a PR for the fix for this issue as well, thanks
PR submitted here: https://github.com/vuejs/vue/pull/8755
Hi @LinusBorg
I see you added some labels to this issue. Is there anything else that I need to do to kick off the review process of the referenced pull request?
Thanks!
Most helpful comment
I can submit a PR for the fix for this issue as well, thanks