Skip to content

Memory leak? #9427

@kevinrenskers

Description

@kevinrenskers

Describe the bug

I am seeing the memory usage of my SvelteKit app, running with the Node adapter, going up and up. I'm not sure how the server's memory usage can keep increasing, all the svelte stores for example are only used in the browser, and other than that the server requests should be stateless, right?

Screenshot_2023-03-05_at_11 47 49

Screenshot 2023-03-16 at 09 12 14

See https://discord.com/channels/457912077277855764/1081891569390583898 for a discussion about this.

Reproduction

As far as I know, any project will show this problem.

Create a new skeleton project. No need to add TypeScript, Prettier, ESLint or anything else.

npm create svelte@latest repro
cd repro
npm i
npm run build
npm run preview

Open http://127.0.0.1:4173/, open the activity monitor (on macOS) or top or whatever else to see memory usage of the Node process, and refresh the webpage a whole bunch of times. You'll see the memory go up. It's slow to increase with such a simple skeleton project so you might need to refresh a whole bunch of times, but it does go up.

In my moderately popular website it goes up by about 300 MB per day.

Logs

No response

System Info

System:
    OS: macOS 13.2.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 274.47 MB / 32.00 GB
    Shell: 3.6.0 - /opt/homebrew/bin/fish
  Binaries:
    Node: 16.17.0 - ~/Library/pnpm/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 8.15.0 - ~/Library/pnpm/npm
  Browsers:
    Chrome: 111.0.5563.64
    Edge: 110.0.1587.69
    Firefox: 110.0.1
    Safari: 16.3
  npmPackages:
    @sveltejs/adapter-auto: ^2.0.0 => 2.0.0
    @sveltejs/kit: ^1.5.0 => 1.11.0
    svelte: ^3.54.0 => 3.56.0
    vite: ^4.0.0 => 4.1.4

Severity

serious, but I can work around it

Additional Information

I have to restart my Node server once in a while or the server just runs out of memory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions