Skip to content

Increased memory consumption in production mode after migration from Next.js 14 to 15 #77318

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

Open
foxable opened this issue Mar 20, 2025 · 2 comments
Labels
linear: next Confirmed issue that is tracked by the Next.js team. Performance Anything with regards to Next.js performance.

Comments

@foxable
Copy link

foxable commented Mar 20, 2025

Link to the code that reproduces this issue

https://github.com/foxable/reproduction-next15-memory-consumption

To Reproduce

  1. Create production build pnpm build
  2. Start production mode: pnpm start
  3. Monitor memory consumption of next-server process

To generate more or less pages, edit generate-pages.mjs and run pnpm generate-pages.

Current vs. Expected behavior

Compared to Next.js 14 (try Next.js 14 reproduction for comparison), the production mode in Next.js 15 shows a significantly increased memory consumption, which also significantly increases with the number of pages:

Memory consumption in production mode

Next.js version 1 page 100 pages
15.2.3 100 - 114 MB 115 - 150 MB
14.2.24 35 - 45 MB 37 - 47 MB

While in absolute numbers, the memory consumption is still arguably low, the relative increase is significant, as well as the additional memory consumption for each page.

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Thu, 13 Mar 2025 18:12:00 +0000
  Available memory (MB): 31793
  Available CPU cores: 16
Binaries:
  Node: 22.13.0
  npm: 10.9.2
  Yarn: 1.22.22
  pnpm: 10.6.3
Relevant Packages:
  next: 15.2.3 // Latest available version is detected (15.2.3).
  eslint-config-next: N/A
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.8.2
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Runtime

Which stage(s) are affected? (Select all that apply)

next start (local)

Additional context

I noticed the increased memory consumption after migrating a project with ~120 pages from Next.js 14.2.24 to Next.js 15. I was also able to reproduce the increased memory consumption with all minor version currently available for Next.js 15.

@github-actions github-actions bot added the Runtime Related to Node.js or Edge Runtime with Next.js. label Mar 20, 2025
@samcx samcx added Performance Anything with regards to Next.js performance. and removed Runtime Related to Node.js or Edge Runtime with Next.js. labels Mar 20, 2025
@bminer
Copy link

bminer commented Mar 22, 2025

Is there any additional information about this issue? Any ideas about what might be causing it?

@foxable
Copy link
Author

foxable commented Mar 23, 2025

I still have no clue what the root cause of the regression could be. In my reproduction scenario, I use a really simple setup of create-next-app with basically empty pages. For this reason, I assume the issue is rather fundamental and was introduced with Next.js 15.

@github-actions github-actions bot added the linear: next Confirmed issue that is tracked by the Next.js team. label Mar 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linear: next Confirmed issue that is tracked by the Next.js team. Performance Anything with regards to Next.js performance.
Projects
None yet
Development

No branches or pull requests

3 participants