Skip to content

Memory leak from changing mounted component's props #17881

@teemingc

Description

@teemingc

Describe the bug

Changing the props of a mounted component following the guide at https://svelte.dev/docs/svelte/v5-migration-guide#Components-are-no-longer-classes seems to increase the memory usage without it ever being released. This affects SvelteKit navigation as we set new props on every navigation.

Reproduction

https://github.com/teemingc/svelte-memory-leak

Instructions are in the README.md

Memory leak still happens even when commenting out the <Counter> component

Logs

System Info

System:
    OS: macOS 26.3.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 124.92 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.22.0 - /Users/teeming/Library/pnpm/node
    Yarn: 3.2.3 - /Users/teeming/Library/pnpm/yarn
    npm: 10.9.4 - /Users/teeming/Library/pnpm/npm
    pnpm: 10.31.0 - /Users/teeming/Library/pnpm/pnpm
    bun: 1.3.9 - /opt/homebrew/bin/bun
  Browsers:
    Chrome: 145.0.7632.160
    Chrome Canary: 135.0.7048.0
    Firefox: 147.0.3
    Firefox Developer Edition: 130.0
    Safari: 26.3.1
    Safari Technology Preview: 26.0
  npmPackages:
    svelte: ^5.45.2 => 5.53.7

Severity

annoyance

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