next.js: Next.js development high memory usage
Before posting a comment on this issue please read this entire post.
Previous work
The past few weeks we’ve been investigating / optimizing various memory usage issues. Specifically geared towards production memory usage. In investigating these we were able to find there was one memory leak in Node.js itself when using fetch() in Node.js versions before 18.17.0 (you’ll want to use 18.17.1 for security patches though).
Most of the reports related to memory usage turned out to be reports of “it’s higher than the previous version” rather than a memory leak. This was expected because in order to run App Router and Pages Router at the same time with different React versions two separate processes were needed. This has been resolved by reducing the amount of processes to two, one for Routing and App Router rendering, and one for Pages Router rendering. So far we haven’t received new reports since the latest release.
In some issues there were reports related to Image Optimization in production, however no reproduction was provided so it could not be investigated adequately, if you have a reproduction for that please refer to this issue: #54482
New
With the memory usage in production resolved we’ve started investigating reports of development memory usage spikes. Unfortunately these reports suffer from the same problem as the production memory usage issues people raised before, they’re full of comments saying same issue or posting screenshots of monitoring tools saying “Look, same issue”.
Unfortunately, as you can image, these replies are not enough to investigate / narrow down what causes the memory usage, for example in multiple cases that we did get a reproduction and could investigate the reason for the high memory usage was:
- A bug in the application code, causing infinite looping components
- Accidental import of ~11.000 modules through icon libraries – Yes, many icon libraries ship massive amounts of re-exports and those have to be bundled before it can be tree-shaken. We’ve been working on an automated way to split these up in #54572 that should help a bit to reduce the size (and compilation speed too).
- Webpack customization, e.g. adding external libraries that change webpack settings, for example to write additional sourcemaps
So far I’ve been able to make one small change to webpack’s memory caching to make it garbage collect a bit more aggressively in #54397. I’m not expecting that change to have a big impact on the reported issues though.
We’d like to investigate these reports further, however we’re unable to narrow these down if there is no code to run to collect heap snapshots and profiles for, hence this issue. If you are able to please provide runnable code of what you’re experiencing.
Comments that don’t include runnable code will be automatically hidden in order to keep this issue productive. This includes comments that only have a screenshot and applications that can’t run.
I’m going to combine the other reports into this issue as separate comments.
I’ve made sure that we have 2-3 engineers on our team available to investigate when we get runnable reproductions to investigate.
Thanks in advance!
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 181
- Comments: 137 (18 by maintainers)
Commits related to this issue
- perf: use split chunks for the node server (#54988) This PR introduces a change in the Next.js server that should improve memory usage nicely during dev. ## How While investigating the repro cases ... — committed to vercel/next.js by feedthejim 3 years ago
- feat(next/image)!: remove `squoosh` in favor of `sharp` as optional dep (#61696) ## History Previously, we added support for `squoosh` because it was a wasm implementation that "just worked" on a... — committed to vercel/next.js by styfle 3 years ago
- feat(next/image)!: remove `squoosh` in favor of `sharp` as optional dependency (#63321) ## History Previously, we added support for `squoosh` because it was a wasm implementation that "just worke... — committed to vercel/next.js by styfle 3 years ago
- feat(next/image)!: remove `squoosh` in favor of `sharp` as optional dependency (#63321) ## History Previously, we added support for `squoosh` because it was a wasm implementation that "just worke... — committed to vercel/next.js by styfle 3 years ago
I have pinned down the issue to next’s global fetch implementation. I’ve created a repo that is very simple and re-creates the memory leak and uses the same logic that by passes it by using node’s http module. There seems to be an issue surrounding
PerformanceRequestTimersandfetchMetrics. More background can be found in issue #64212I’ve posted a reproduction here: https://github.com/limeburst/vercel-nextjs-54708
Start the development server, navigate from
http://localhost:3000/1http://localhost:3000/2http://localhost:3000/20And watch the memory usage grow, until the server restarts.
This is insane, it seems like it got worse with 15.1?
Same app, cold start on a 32GB machine:
With Turbopack:
With Webpack (much better):
@noetix Disagree that this had anything to do with bullying. All I did was explain that my posts are continuously being ignored, including in this issue. Then I explained what to do, which is to provide a runnable application. There is nothing we can do without a runnable example, which was already shared in the initial issue, I even made it bold to highlight that further.
Happy to explain it again, the reason we can’t do anything without runnable code is that in order to narrow down the memory usage we need to change the Next.js core code in the application, for example to disable client components compilation and such in order to narrow down where the memory usage comes from. There is no way to do that based on screenshots / messages / information you can provide as it would require countless hours of your time and our time (think 2 weeks full time at least) in order to investigate this.
The emoji reactions not being shown for off-topic marked posts is a bug in GitHub. As mentioned in the initial issue any posts that don’t include a reproduction will be automatically hidden.
Since you didn’t like the earlier explanation I’ll just remove it, don’t feel strongly about keeping the comment. Definitely wasn’t bullying, you were reading into that. Bullying would be the threats I’ve received recently from anonymous developers on Twitter that they’ll come visit my house soon…
@weyert we haven’t made changes to development memory usage besides the PR linked in the issue so really all I need is a reproduction, luckily @AhmedChabayta posted one, hopefully that is enough, fingers crossed.
@Thinkscape please open a separate issue, that bug would be separate from this issue 👍
Was wondering why my laptop was slowly dying…
Tried using turbo but still got up to 8GB, any ideas? Am slowly trying to get a repro, starting with testing out removing the icon libraries, initial tests are still returning +10GB of memory used, it’s a fairly large app thats slowly being migrated from pages to app router, so creating a repro is taking a lot of work.
Added note: I’m also curious about the rationale of the fix being “it must be your icon library”. are we just now expected to vet every package we use in case it causes a memory leak in next? was this always a thing? I understand that we should be conscious of what packages we use, but im maintaining a load of next.js projects that have different icons libraries, ui libraries, etc do I just have to migrate off these now to move to the app router? is there no way to fix memory issues in next, for example with react-icons?
Nextjs single-handedly promoted memory consumption and the development of semiconductors, it’s human hope!
mine consumed ~13GB of memory which is insane
I’ve had the same exact issue for weeks, I keep reading there is no reproduction on this issue, for me it’s pretty much running the getting started example using the App router, just create a dummy page that renders a div and load the page 1 single time and the memory almost doubles never releasing anything back. If you give it a few more spins, like 50-100 requests, it goes 1.5x-2x higher again. At some point it goes down by a small amount then it remains stable with slight memory increase just by idling and serving no requests at all, and it keeps going up till it eventually is OMM Killed.
Ran it a bunch of times through the memory snapshot inspection, even that tool always shows a 50-100Kbps increase at all times.
When everyone is reporting this exact same issue, it’s a bit irresponsible to say the least that there is no memory leak and just close the issue. I must say, posting screenshots with memory charts is not the most useful thing to repro this, but when 80% of people commenting experience the same issue, it’s saddens me to see the issue being denied or ignored. Again, I don’t use anything fancy, to decouple away from any potential leaky dependencies, I just slightly throw in some requests in the getting started example and the same exact memory increasing pattern repeats, whether it’s development or production mode.
At this point I am seriously considering ditching Next.js for my project and picking some other SSG and move the backend on something else.
For those who still suffering from using React-icons, cause of “Out of memory” issue, I have been searching for a solution and here is the best I got!
React-icons ships with huge amount of icons export from one file, like “react-icons/md” (even if you use one icon from it), For solving this issue, react-icons has another package that has separated files for each icon, called “@react-icons/all-files”, But unfortunately they stopped releasing it on NPM, because it became having huge amount of files, and NPM doesn’t accept that, instead you can install directly from GITHUB by using
npm install https://github.com/react-icons/react-icons/releases/download/v4.11.0/react-icons-all-files-4.11.0.tgz, (or you can take the latest version from the releases pagehttps://github.com/react-icons/react-icons/releases,Well, now there’s one problem, for Developer experience, importing multiple icons from one path (one statement) is better, using destruction, But we can’t use that with
@react-icons/all-files, so to solve this issue:We can use
modularizeImports, which transform the import from shape to another, here is what you should put into your next.config.js:modularizeImports: { "react-icons/(\\w*)/?": { transform:@react-icons/all-files/{{ matches.[1] }}/{{ member }}, skipDefaultConversion: true, }, },|Now you keep the project with the normal
react-iconsimport, modularizeImports does all the magic.And Yeah! that’s it, I hope that I helped anyone.
This is still very much an issue. Currently running into 6-7 GB’s used just for the ideal server, I’m not even navigating around the app.
Any tips or insights would be awesome, seems like this issue has been open for a while
🎉 After 2 years, I finally solved the issue: upgraded my laptop to 64 GB RAM. Yes, sixty-four gigabytes.
Now I can run two Next.js projects at the same time.
RAM usage? Just 15 GB. Smooth as butter.
Perhaps this should be added to the docs as a workaround:
When in doubt, buy more RAM.Thanks, Vercel 🙃
Hey everyone, as part of Turbopack we’ve also implemented thorough memory tracing which allows for narrowing down why certain applications use a lot of memory. Can you follow these steps when using Turbopack and send us the relevant files:
If possible follow these steps which would give me the best picture to investigate:
npm install next@canary(use the package manager you’re using) – We want to make sure you’re using the very latest version of Next.js which includes the fixes mentioned earlier.rm -rf .nextNEXT_CPU_PROF=1andNEXT_TURBOPACK_TRACING=1(regardless of if you’re using Turbopack, it only affects when you do use Turbopack) environment variable. E.g.:NEXT_TURBOPACK_TRACING=1 NEXT_CPU_PROF=1 npm run devNEXT_TURBOPACK_TRACING=1 NEXT_CPU_PROF=1 yarn devNEXT_TURBOPACK_TRACING=1 NEXT_CPU_PROF=1 pnpm devctrl+c).next/tracefile to https://gist.github.com – Please don’t run trace-to-tree yourself, as I use some other tools (e.g. Jaeger) that require the actual trace file..next/trace.logas well, if it’s too large for GitHub gists you can upload it to Google Drive or Dropbox and share it through that.next.config.js(if you have one) to https://gist.github.comIt’s important to note that this is not a memory leak, it’s high memory usage, which is very different than leaking memory. Leaking memory means the memory is unused but can’t be cleaned up. In this case the memory is used (i.e. memory caches of webpack and such).
It’s also important to note that Turbopack memory usage is not fully optimized yet, right now it uses more memory than where we want the memory usage to be for Turbopack, at least a 50% reduction is what we’re aiming for right now and that is being worked on currently.
Incorrect usage of icon libraries is just one cause of high memory usage, will try to explain why a bit:
There’s libraries that ship 10.000 re-exported modules that all have to be analyzed before tree-shaking.
Next.js needs to compile your code (including node_modules) for multiple targets depending on your application:
runtime = 'edge'(if you’re using it) – This is a separate compilationIf you use all of those combined you’re compiling not 10.000 modules but:
Obviously people use some combination of these, but it illustrates why misusing icon imports can be one of the problems.
After doing some profiling, it seems like server modules are leaked across HMR in development, which in my company’s case leads to rapid growth of memory due to a large backend (see https://github.com/vercel/next.js/issues/62217, auto-closed unfortunately). Curious if anyone else can repro / confirm the same thing, or confirm theirs don’t leak.
Faster computers make faster CPUs, fasters CPUs make programmers program slow code, slow code makes most used frontend framework do oom sepuku
Vercel cooked too much
What about users who don’t use Turbopack?
I am facing this even with clean project. Just created a new project and a couple of libs (I am using nx) See recording
https://github.com/vercel/next.js/assets/54899662/d6d9833b-1937-4b91-98e4-13228f5c46f0
I guess on clean project with one page it doesn’t grow fast, but on bigger project it grows really fast. I am able to reproduce it by simply refreshing a page.
Reproducible example https://github.com/tar-aldev/next-nx-cypress Just run it with
npm run nx serve comp-test.Using
Using node v20 doesn’t change anything.
Here’s a test repo (with a branch I’ll leave,
memory-usage-freeze-state) which is experiencing this when runningpnpm run dev. It’s a pretty new starter site, and often gets stuck compiling the root of the site with a message likeCompiling / ...From this repository I can reproduce this fairly regularly by performing the following steps:
pnpm run devThis causes the server to get stuck compiling and the memory usage blows up.
Here’s an example from the console which shows the process of loading the main page and it getting stuck, using a ton of memory, and then eventually restarting.
Image
I’ve noticed that when this happens you can watch the memory usage increasing and increasing over time until the inevitable crash and reset.
This does NOT happen if I remove
--turbopackfrom the dev script.is there any workaround for it?
TLDR: The fix for us was converting our usages of
next/imageto using plain img tags.We’ve been experiencing many similar issues. After deploying, server memory drops way down, and grows very quickly initially, then slows down but continues until we get an out of memory crash. We’ve tried a lot of the potential fixes here (upgrading, downgrading, changing node versions…).
We have thousands of pages that
next/imagewas being used on. It seems that the server is keeping a cache of these images, or some other related memory leak, but either way, converting away fixed the issue.Our server memory after deploying has gone from this:

To this:
For anyone else looking to convert until this is fixed, you can can inspect the
next/imageas currently implemented and copy over many of the styles to achieve the same look. Obviously a rudimentary conversion, since you don’t get the Next magic included, but better than a server crash.@timneutkens If any other info would help, let me know, and we’ll try to provide it
How is this a workaround? Next dev server will keep restarting itself if it reaches the memory threshold when using Webpack. When using Turbopack it’ll just silently kill itself.
On Tue, 26 Nov 2024, 06:21 Sharath, @.***> wrote:
10gb RAM usage on a rather fresh project. I think this is a very important issue. How can we diagnose/profile what’s causing this massive RAM usage ourselves?
I tested with a new project and haven’t used Axios, Fetch, or any other libraries yet—it’s a fresh project, but I’m still encountering the issue. nextjs antd tailwind .
my terminal consume 7GB memory . engine : mbpm1 ( macOS sequoia 15.0.1 )
edit : “I think it’s consuming my disk space (5GB - 7GB) because it’s overloaded. My friend, working on the same project, is using 13GB of memory.”
These worked to me so far:
fetch, switch toaxiosv20.15.1(not lower, not higher)Read more here: https://github.com/vercel/next.js/issues/64212
@timneutkens could you take a quick look at the dump in https://github.com/vercel/next.js/issues/62217? Auto-closed but I shared the heap dumps there (hard to share a repro unfortunately). I’m mainly curious if its expected for old module source-map strings to be retained in general, or if it indicates something not cleaned up properly? If its due to something not properly cleaned up, should there be mechanisms for that (https://github.com/vercel/next.js/issues/46018)? And should we expect so many modules to need to be recompiled (https://github.com/vercel/next.js/issues/45204)?
This might be dumb, but I think I managed to solve the issue on my machine. After spending days suffering with this high memory usage issue, I just built a new next app and incremently added all the packages in my exisitng application.
The main problem was the way I was importing icons. I am using react-icons and lucide-react with shadcn/ui.
Problematic Way
My Fix
After making this change the number of modules compiled in dev mode dropped by about 50%! Everything seems to be working a lot better now and I hope things stays like this.
Hopefully this helps someone! 🚀
I’m getting ‘server out of memory’ after a while by letting the server run and writing/saving code that calls the following functions a few times.
Node v. v18.17.1
It’s been 2 years and this bug still crashed my laptop every couple minutes, nice work guys.
Very raw turbo we got here
Pardon my 16gb of ram
I’m experiencing high memory consumption when deploying my Next.js (15.2.4) app on DigitalOcean App Platform. I have a 1GB RAM plan with a shared CPU, and it’s using all of it. Should I upgrade the RAM, or is 1GB sufficient? I’m using Strapi as a CMS with GraphQL.
This is my memory usage
this is my cpu usage which is low
this is restart count for same timeline
Facing the same issue while deploying on Digital Ocean App Platform — due to this issue, my app’s memory usage hits 100%, causing frequent restarts.
Workaround for Linux users.
You can use the following command to limit the memory usage of the dev server. The compilations get slower when your memory limit is too small.
Source: https://unix.stackexchange.com/a/536046
EDIT: This command limits the physical memory usage only. If your system doesn’t have swap memory allocated, this method will crash the process.
One thing I’ve uncovered recently is a stateful server can easily leak memory in development only. While nextjs does encourage a stateless server (I suppose you need to use a separate server otherwise), its easy to write code that subtly causes the same issue. These are pretty painful to fix today, but with module.hot support it could be much easier (although discussions on that seem stagnant)
Some examples:
axios-retry,process.onlifecycle hooks, addingmongooseschemas, etc.These can all lead to that version of the module (and its downstream dependencies) never getting garbage collected (since there’s a dangling reference to it). This means every time you save a server module, a new copy of all your server modules is added to memory. If you re-save server files a lot, and have a large backend, this can lead to OOMs quickly.
The only workaround I’ve found today is to pollute the global namespace with cleanup functions that get invoked when the module is re-imported (so you can shutdown the old database client, or clear the old interval, etc.)
@feedthejim can confirm
next@canaryfixes the out of memory crash when usinggoogleapis. thanks!My fix only applies in development so I wouldn’t expect changes there.
You can try the latest by installing next@canary btw.
Are there plans to do a Next release? Would love to try out the memory fixes in production
Its interesting that the downvote emojis on the bullying post have been removed.
All the dude did was ask how to collect data in a way that would be helpful. If collecting our own data is out of the question then that should have been the answer.
Poor form for someone representing Vercel.
This is not only an issue in development, but also production…
We’re using pages router with middleware and It seems like there is a memory leak in get cookies inside middleware.
In our case the problem manifest mostly when the site is using dynamic rendering. This already happens automatically (for every page) when you have any sort of login box in your layout that sets hearders / cookies. Sites without this and are thus statically pre-rendered don’t suffer from this big memory consumption, which is sort of understandable.
However the real problem is that the memory will not significantly be freed over time. Even after 24 hours doing nothing, then next day the memory would still sit at the same level. I’m not sure if this is directly related to Next JS or maybe Node JS itself. We are not experts on this subject.
Currently we are waiting for partial prerendering. https://nextjs.org/learn/dashboard-app/partial-prerendering. This looks promising and would potentially result in less consumption and therefore less server restarts.
If anyone has a solution for a dynamically rendered site (next 14) that prevents the memory getting full resulting in a forced reset please tell me your solution.
Honestly, I wouldn’t care about RAM usage if compilation would be fast, but currently Next gives worst in class DX. I’m running 10yr old MLOC Webpack projects with federation faster than Next for a single route…
On Tue, 17 Jun 2025, 20:05 Ali Oguzhan Yildiz, @.***> wrote:
I think 6GB is way too high for development. I am running next-js along with docker for my python backend server and the usage skyrockets to 85-90% RAM which makes it borderline unusable. (I’m on Ubuntu with 16GB RAM)
The cause of the RAM overflow is using fetch. I had the same issue; I replaced all fetch requests with axios, and the project never went over 200MB of RAM after that.
Thank you for your suggestion. I appreciate your time. I tried your solution, but it seems to be the same, if not worse, than the latest version of Node.js. As for fetch and Axios, I don’t use fetch anywhere in my project, so that’s not the issue. I’m also using the latest version of Next.js to avoid any bugs that have already been resolved
Similar to @JClackett I just hovering around 4GB memory usage. Also reloads takes like 30s for normal size pages.

Similar to @JClackett I just hovering around 6GB memory usage. Also reloads takes like 30s for normal size pages.
I had my app running in a docker container and had to pull it out because the dev server kept running out of memory and rebooting. However, the issue is now, outside of docker, it’s consuming a TON of memory on my Mac, and sometimes making it crawl. I’ve seen
next-serverconsuming 2.5GB 🤯Out of memory problem has been an issue since the beginning of next 13 (or maybe even earlier). You can do all the optimalizations as presented here, they will help, but eventually the memory gets filled regardless and your pod will ultimately crash. Especially if you have a lot of dynamic parts. The solution we implemented (on prod) is to run at least 2 nodes and add a memory watch on the nodes that will restart the pod when a threshold is reached. (I suspect Vercel hosting has something similar). Without this it would have been a complete shit show since we have multiple crashes a day.
This does not fix your local development issue. The Next JS team has made some progress on this (since 13.4), and you server should not crash that soon (unless you’re stress testing it).
I’m having some issues when trying to use a server action with prisma.
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memoryI’ve tried to create a minimum reproduction repo but I couldn’t do it. I’m glad to help in any way
Unfortunately, no. And I got no response in neither the issue I created nor in Discord. To make it even worse I also reproduced it with App router.
On Fri, Nov 10, 2023, 7:07 AM William Scotten @.***> wrote:
I confirm. Navigate from
http://localhost:3000/1tohttp://localhost:3000/20.You can use this code to see the issue. The server is getting aborted silently without any errors.
https://github.com/codelitdev/courselit/tree/tailwindcss-2
Logs
i was building an app using the app directory, and i kept getting server out of memory in console, and some sort of input error in the browser, the server crashes and thats that, no errors beyond the ones mentioned, furthermore, the app was slow in loading, i created another app using pages this time, kept everything exactly the same just made it the proper pages format, and all the issues have gone. no more server out of memory, nor slow loading times. Next.js is and most probably will remain my personal favorite react framework, but this shit is ridiculous. maybe we get an explanation at least to why this is happening? i spent f** hours trying to find out what i did wrong, only to realize the problem isnt from my code.
i updated Nextjs to the latest version, updated node, used different versions of node via nvm, removed my code block by block to see if the issue is coming from some broken piece of code, same shit. the only solution was to move on from the app directory.
Please tell me someone is fixing it, if I spend $2K on a new mac with bigger memory, and I still see this issue, I’ll be really really pissed. Although my PC doesn’t experience this, and has 32Gigs of RAM on it. But M2 mac with 8 Gigis is unusable RN.
doesnt work still in case consume high memory here is my full
next.config.jsfor now is there any workaround to this issue , i have a 12gb ram laptop and i can’t continue programming my website , it’s always 90% to 100% full after navigating to multiple web pages in dev mode , i hope this issue got solved soon , my entire system ram usage is 1.7 the remaining is eaten by dev mode
For those who are having issues with
react-icons.I currently have to work on a laptop with only 8G memory. I couldn’t even render the first page before Next dying. I created this tool that you can use to purge all unused icons from the source files. Only for development for those who are completely blocked by this.
https://github.com/wintercounter/purge-react-icons
my next-server using 10.67GB memory on MacBook Air M1.
have the same issue ,when running
npm run dev,it freezes my browser i have to shutdown the laptop or close the vs code and the browser too.sometimes If I wanna test on the browser I have to kill one application i.e the vs code and view my changes in the browser when done kill the next server and continue coding.This is so borrowing . am using the followingNode v18.17.1 "next" "13.4.3", "typescript": "5.0.4",For pages which depend on auth state but irrelevant for SEO purposes just go for the good old client-side render. Basically pre-render the page with all auth-dependent components showing a placeholder and then resolve auth state upon hydration on client.
@AdamZajler Im in development using next
14.1.0, i just got the same issue. Sometimes i my computer getting freeze when i runnpm start devfyi i use 32gb of ram and 16 threads processor. this is my dependency listWe have detected that the solution from here is working. But we can’t resign from using next/image. Also we discovered that after disable CDN (assetPrefix), everything is fine:
Next.js version: 13.4.19
What a rollercoaster. I also use the lucide-react package, thought that’s the culprit. It fixed the build on my local machine after replacing it with SVG icons hosted in my codebase, but it was still crashing with a heap out of memory error when deploying to prod.
I’ve got an SST app with a NextJS site, with multiple pnpm workspaces. The issue was that I had different versions of zod in these workspaces (3.22.4 and 3.22.2). Updated all to be X.X.4 and the problem was no more.
Hello,
I’m experiencing an issue that might be related to the problem discussed in this Git issue. This issue is currently blocking my team from migrating our project to use the edge runtime.
The problem I’m facing involves a significant difference in RAM usage during compilation when using the
experimental-edgeruntime compared to the nodejs runtime. I encountered this issue when I created a fresh project usingcreate-next-appwith the pages router and then multiplied the default Next.js pages with different names and placed them in different directories, resulting in approximately 115 pages, which is nearly my project’s size.On my laptop, when I build the project with the
experimental-edgeruntime, the RAM usage spikes from 10 GB to 15.8 GB (100%) during compilation, and the process takes approximately 1 minute to complete. However, when I use the nodejs runtime, the RAM usage only reaches around 11.4 GB at its peak, and the compilation finishes in about 10 seconds.You can reproduce this issue by checking out the
mainbranch, which uses the nodejs runtime, and theruntime-experimental-edgebranch, which uses the edge runtime. I’ve also included some screenshots in the public folder of my memory monitor in the task manager for confirmation, in case they are relevant to troubleshooting this problem.Node version: 18.18.2
Repository for reproduction: https://github.com/gvatsov/high-ram-example
Same here but after upgrading to the canary it started popping unexpected errors in production like this, I’m afraid to bump to
13.5.1because there are also reports(#1, #2, #3) of the same problem in this new version@MariuzM make sure that you test the latest canary (currently
next@13.4.20-canary.31) from the Releases pageIn the comment for the fix you mention
In development, we want to split code that comes from 'node_modules' into their own chunks. This is because in development, we often need to reload the user bundle due to changes in the code.. In our case we’re seeing the infinite memory crash occurring only in production under significant load and especially related to theundicifetch failures. Can a fix related to compilation be related to that? Does Next re-import the dependency tree on every page render?Please see the first comment 🙏
My comment wasn’t relevant, so I have deleted the content, thank you @kachkaev
Upgrading from
next@13.4.12tonext@13.4.19didn’t solve the memleak, however it broke the server restart. In.12I’d get the (too often) memory running out warning, then the server would restart and a refresh in the browser would work (system user mem usage would dip by a few GB after restart)Thanks! Added both to our internal copy of this issue so that your keys don’t leak. We’ll take a look!
I understand your frustration with all the “same” comments, but I’m sorry to say I’m doing my best to be helpful here @timneutkens. I’m not an experienced enough developer to get to the bottom of this myself, and I was just offering the best I could to try and support by collecting data locally.
I’ll leave it to you and the pros.