Repository navigation
Description
Vue version
3.5.32
Link to minimal reproduction
https://github.com/bgarcias-cp/nuxt-v4-memory-leak
Steps to reproduce
Steps to reproduce the memory leak:
- Clone the repo and install dependencies.
- Build the project: npm run build.
- Launch the server: node --inspect .output/server/index.mjs.
- Run load test: autocannon -c 10 -d 20 http://localhost:3000/.
Result:
Memory footprint grows from 13.7 MB to 122 MB. The leak persists even after garbage collection.
There are numerous string objects holding references to EffectScope, specifically originating from reactivity.cjs.prod.js and runtime-core.cjs.prod.js
What is expected?
Memory usage should remain stable after the load test finishes, and any temporary objects should be cleared by the garbage collector, returning the heap size to near-baseline levels.
What is actually happening?
uring the load test, memory usage scales linearly with the number of requests, increasing from 13.7 MB to 122 MB. Analysis of the heap snapshot reveals a large accumulation of string objects that maintain active references to EffectScope. These references are traced back to reactivity.cjs.prod.js:15 and runtime-core.cjs.prod.js:6450, suggesting that scopes are not being properly disposed of after the request lifecycle, even when the garbage collector is manually triggered.
System Info
System:
OS: macOS 15.7.4
CPU: (10) arm64 Apple M2 Pro
Memory: 95.27 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.20.0 - /Users/b.garcias_cyberpuert/.nvm/versions/node/v20.20.0/bin/node
npm: 10.8.2 - /Users/b.garcias_cyberpuert/.nvm/versions/node/v20.20.0/bin/npm
pnpm: 10.33.0 - /Users/b.garcias_cyberpuert/.nvm/versions/node/v20.20.0/bin/pnpm
Browsers:
Chrome: 147.0.7727.55
Firefox: 147.0.1
Firefox Developer Edition: 149.0
Safari: 18.6
npmPackages:
vue: 3.5.32 => 3.5.32Any additional comments?
No response
Activity
bgarcias-cp commentedon Apr 10, 2026
Hi @edison1105,
I found a memory leak in Vue 3.5.12 and created a minimal reproduction here: #14706.
Would you mind taking a look at the issue? Thanks!
edison1105 commentedon Apr 10, 2026
I can't reproduce it with your reproduction. But it can reproduce with
asyncContext:true.It seems a duplicate of unjs/unctx#125. I have already investigated this memory issue before.
see