High RAM usage in Next.js development server #94995
Replies: 3 comments 7 replies
-
|
This could be related to the dev server file watcher, Turbopack/Webpack rebuilds, or Node.js memory behavior. A few things to check:
Also, please share the command you are using, package manager, and whether this happens with Turbopack or Webpack. |
Beta Was this translation helpful? Give feedback.
-
|
The most common cause is the default file‑watcher keeping every change in memory. Try the dev‑server settings recommended in the docs: # .env.local (or add to next.config.js)
NEXT_TELEMETRY_DISABLED=1 # turn off telemetry
NEXT_DISABLE_MEMORY_LIMIT=0 # let Next enforce its own limit
NEXT_WATCHPACK_POLLING=true # use polling instead of native watcheror, if you’re using Turbopack (the default in v16): // next.config.js
module.exports = {
experimental: {
turbopackMemoryLimit: 2048, // limit to 2 GB (adjust to your RAM)
},
};After adding the config, stop the dev server, delete rm -rf .next node_modules/.cache
npm run devIf RAM still climbs, upgrade to the latest Node 20 LTS (Node 24 has known memory‑leak regressions on Windows) and make sure you’re not loading huge static assets or unbounded |
Beta Was this translation helpful? Give feedback.
-
|
A couple of the suggestions above ( The two real knobs for this in 16.x are:
Since you're on Windows 11, the two most common causes I've run into aren't Next-specific at all:
If it's still climbing after ruling those out, there's an actual measurement path instead of guessing: run with |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Next.js dev server is using very high RAM while running locall
Additional information
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions