Separated dom elements cannot be freed, and memory keeps increasing
Vue version
3.4.4
Link to minimal reproduction
https://github.com/Joshua-Leee/vue-element-plus-test
Steps to reproduce
Run the project locally, or enable nginx to run the packaged file, switching home and about routes repeatedly
What is expected?
After switching routes, the memory of the previous route can be freed, and the separated elements can also be freed
What is actually happening?
The separated element is not released, it remains in memory, and memory cannot be lowered
System Info
System:
OS: macOS 10.15.7
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 111.44 MB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 18.13.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 8.19.3 - /usr/local/bin/npm
pnpm: 8.13.1 - /usr/local/bin/pnpm
Browsers:
Chrome: 120.0.6099.129
Safari: 15.6.1
npmPackages:
vue: ^3.3.11 => 3.4.4
Any additional comments?
No response
@Joshua-Leee Did you still have this problem after disable vue-devtools? see more https://github.com/vuejs/devtools/issues/1877
Yes, it was tried, but the effect is still the same, you can also visit this online address to debug: http://www.szchizhou.com/
You may not understand what I mean, I am not saying that the number of page dom increases, but that there are dom elements that are out of the document in memory, you can try to switch several times, you can see that the separated dom elements are not released
This is then normal, because of static hoisting does cause a copy of the DOM tree to be cached. As long as the total memory usage does not increase over time this is not considered a memory leak.
Closing as duplicate of #5256
I'm sorry, do you mean the memory that the memory snapshot shows? Because my company's project is relatively large, there are a lot of page data, and keepalive is also used, opening a page will increase tens of megabytes of memory, when closing the page, there will be a lot of free dom elements, resulting in the browser window quickly stuck, unable to continue operation