[NEXT-1314] High memory usage in deployed Next.js project
Problem
Verify canary release - [X] I verified that the issue exists in the latest Next.js canary release Provide environment information [code block] Which area(s) of Next.js are affected? (leave empty if unsure) _No response_ Link to the code that reproduces this issue https://codesandbox.io/p/github/ProchaLu/next-js-ram-example/ To Reproduce - Clone the repository: https://github.com/ProchaLu/next-js-ram-example - Deploy the project on Fly.io Describe the Bug I have been working on a small project to reproduce an issue related to memory usage in Next.js. The project is built using the Next.js canary version `13.4.3-canary.1`. It utilizes Next.js with App Router and Server Actions and does not use a database. The problem arises when deploying the project on different platforms and observing the memory usage behavior. I have deployed the project on multiple platforms for testing purposes, including Vercel and Fly.io. - On Vercel: https://next-js-ram-example.vercel.app/ When interacting with the deployed version on Vercel, the project responds as expected. The memory usage remains stable and does not show any significant increase or latency - On Fly.io: https://memory-test.fly.dev/ However, when deploying the project on Fly.io, I noticed that the memory usage constantly remains around 220 MB, even during normal usage scenarios Expected Behavior I expect the small project to run smoothly without encountering any memory-related issues when deployed
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: [NEXT-1314] High memory usage in deployed Next.js project
@thexpand This is not related to Server Actions. It is a severe memory leak starting from v13.3.5-canary.9. I was going to open a bug but found this one. @shuding I suspect your PR https://github.com/vercel/next.js/pull/49116 as others in mentioned canary are not likely to cause this. Can you please take a look? This blocks us from upgrading to the latest Next.js. [code block] Tech Stack: - Rus
Trust Score
7 verifications
- 1
@thexpand This is not related to Server Actions. It is a severe memory leak star
@thexpand This is not related to Server Actions. It is a severe memory leak starting from v13.3.5-canary.9. I was going to open a bug but found this one.
- 2
@shuding I suspect your PR https://github.com/vercel/next.js/pull/49116 as other
@shuding I suspect your PR https://github.com/vercel/next.js/pull/49116 as others in mentioned canary are not likely to cause this. Can you please take a look? This blocks us from upgrading to the latest Next.js.
- 3
Tech Stack:
- Rush.js monorepo (on pnpm) - +several Next.js apps in SSG (no SSR, no app dir but with `next/image` (not legacy one) and with `middleware.js` and few `redirects` and `rewrites` in `next.config.js`) - +all of which uses latest (v7) common/storybook as 90% of theirs code base (so `transpileModules` is used for it) - +external configuration and MaterialUI styles comes from Apollo Client used in getStaticProps pointing towards Strapi GraphQL (so on-demand revalidation is used) - and everything deployed to our Kubernetes (build and run-time both are using latest Bullseye Debian so that `sharp` f
- 4
Step 4
13.3.5-canary.8 vs 13.3.5-canary.9
Validation
Resolved in vercel/next.js GitHub issue #49929. Community reactions: 38 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep