Skip to content

Effect Scope Memory Leak #14706

Closed
Closed

Description

@bgarcias-cp

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:

  1. Clone the repo and install dependencies.
  2. Build the project: npm run build.
  3. Launch the server: node --inspect .output/server/index.mjs.
  4. 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

Image

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.32

Any additional comments?

No response

Activity

  1. bgarcias-cp commented on Apr 10, 2026

    @bgarcias-cp
    Author

    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!

  2. edison1105 commented on Apr 10, 2026

    @edison1105
    Member

    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

  3. locked and limited conversation to collaborators on Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions