bug: Memory leak for components produced by the dist
output target
#6119
Labels
Bug: Validated
This PR or Issue is verified to be a bug within Stencil
Prerequisites
Stencil Version
4.25.0
Current Behavior
Components created by the output target
dist
still have the a memory leak.The latest fix of that issue indeed fixed half of the problems. If we take a look closer we'll see that:
disconnectedCallback
hereAnd that works perfectly for the type
dist-custom-elements
. In the second point, we can see that this function is called.But for the type
dist
this function wasn't called hereTo reproduce that I've created an empty project here. That project has two types of output:
dist
anddist-custom-elements
.If we run the build command and compare the output results we'll next thing: the function


deleteHostRef
will be called only in the specificdist-custom-elements
output type.I've also tried to modify the output of the

dist
by adding thehostRefs
cleaning, but it didn't change the result. I guess I'm missing something here:Demo
I recorded a small demo to check that. The app renders 121 components, so I removed all those components with the console and then checked the memory.
In the first part, I perform a memory test for the
dist
output target. We see that the components are still stored in memory.In the second part I connect files generated by the
dist-custom-elements
and do the same but there are no components.Expected Behavior
I guess if we add the
deleteHostRef
for thedisconnectedCallback
here it might fix the issue.System Info
Steps to Reproduce
npm i && npm run build
dist
dist
More here: https://www.youtube.com/watch?v=UC41uNGhGmg
Code Reproduction URL
https://github.com/seregindev/stencil-memory-test
Additional Information
No response
The text was updated successfully, but these errors were encountered: