Next.js Discord

Discord Forum

Bug Report: Memory Leak in Next.js 14.2.14 Dev Server

Answered
remib18 posted this in #help-forum
Open in Discord
Hi,
I’m working on a side project with the latest stable version of Next.js (14.2.14) and encountered a significant memory leak (~10GB) that causes the process to be killed by macOS.

This issue arises when calling a server action within a client context (in my case, using Tanstack Query's useMutation). After the leak occurs once, it persists even after restarting the dev server, forcing me to reboot my machine.

Let me know if you need more information.

Thanks!
Answered by remib18
In my case, it was actually a very rare case that i had omitted to check for ending up in an endless loop 😅
I do not see any new memory leak as of now. I do find it a little strange that nextjs do not have verifications to prevent / detect memory leak : i would have expected an error indicating that the issue was on my part ^^
View full answer

4 Replies

After further investigations, it seem to be unrelated to nextjs since it happens only on a dynamic route with a certain parameter.
In my case, it was actually a very rare case that i had omitted to check for ending up in an endless loop 😅
I do not see any new memory leak as of now. I do find it a little strange that nextjs do not have verifications to prevent / detect memory leak : i would have expected an error indicating that the issue was on my part ^^
Answer