Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible memory leak in Svelte 5.25.6 #15690

Closed
chris838 opened this issue Apr 5, 2025 · 0 comments · Fixed by #15694
Closed

Possible memory leak in Svelte 5.25.6 #15690

chris838 opened this issue Apr 5, 2025 · 0 comments · Fixed by #15694
Assignees

Comments

@chris838
Copy link

chris838 commented Apr 5, 2025

Describe the bug

When using Svelte 5.25.6, a simple SVG drawing app (adapted from this Joy of Code example) seems to create a memory leak.

Screenshot shows a snapshot of the heap using Chrome dev tools. Notice the instances of Circle that have accumulated, despite the canvas being cleared.

The same example works fine in Svelte 5.19.6 (not tested any other versions).

Image

Initially posted on StackOverflow.

Reproduction

Run the example from the links below, hit "Add 2 Circles" once and "Delete Circle" twice. The canvas is clear, but inspecting the heap using Chrome shows instances of Circle class still retained.

Repeat several times and the retained instances accumulate.

Perform the same experiment on 5.19.6 and once the canvas is clear, no instances of Circle are retained.

https://svelte.dev/playground/9aa0409c6b4f4e2bba5939553ab2d6d0?version=5.25.6 (memory leak)
https://svelte.dev/playground/9aa0409c6b4f4e2bba5939553ab2d6d0?version=5.19.6 (no memory leak)

Logs

System Info

npx envinfo --system --npmPackages svelte,rollup,webpack --binaries --browsers

  System:
    OS: macOS 15.1.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 149.80 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.9.0 - ~/.nvm/versions/node/v20.9.0/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 10.1.0 - ~/.nvm/versions/node/v20.9.0/bin/npm
    pnpm: 9.2.0 - ~/Library/pnpm/pnpm
  Browsers:
    Chrome: 135.0.7049.41
    Safari: 18.1.1
  npmPackages:
    svelte: ^5.0.0 => 5.25.6

Severity

blocking an upgrade

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants