-
Notifications
You must be signed in to change notification settings - Fork 28.9k
Description
Link to the code that reproduces this issue
https://github.com/diogomartino/next-app-router-playground
To Reproduce
- Start the app in dev mode
- Open every single route you have available
- Memory usage keeps rising like crazy. The more routes you have, the more the RAM rises.
Current vs. Expected behavior
I expected that NextJS didn't use 10GB.
Provide environment information
Ubuntu 22.04.5 LTS x86_64
Kernel: 6.8.0-57-generic
pnpm 7.33.5
Node v20.13.1
next: 15.2.3
Using turbo.
Which area(s) are affected? (Select all that apply)
Performance
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
So I made a script that fetches every single route for my project and plotted the RAM usage so you can see it increasing. As soon as all routes are fetched at least once, the memory usage stabilizes.
For my project, the next-server
starts at like 300 MB and rises all the way up to 9-10 GB. I also tried a template from vercel (https://vercel.com/templates/next.js/app-directory) and the same happens, but it's not so noticeable because the code is much simpler and it has fewer routes. In the template case, it wen't up to like 4GB, which is already too much.
I also tried with the most recent version (15.3.0) and it's the same.