Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NextJs next-router-worker consuming more memory space. M1 MacBook gets lock automatically due to heavy memory usage

Tags:

next.js13

Recently I was working on a NextJs project and my mac suddenly gets blank, it get locked. After some findings I checked the processes on activity monitor, there I found one process which was consuming 1.9GB of memory space which made the mac to lock the screen.

My project has some routes in that ( like home, library, about ) so that I created a new NextJs project and ran that preloaded template and checked the activity monitor once again and what there was same next-router-worker which has taken a quit big memory space ( 2.02GB ).

Why is this happening or have I made some errors ?

If anybody knows Please help, this is what next-router-worker process looks like

NextJs version - v13 device - M1 Macbook

like image 932
Sahil Bhor Avatar asked Sep 01 '25 01:09

Sahil Bhor


1 Answers

I have also noticed the memory leak issue with the next-worker-router. In my case, it spiked around upto 2-3 GB before running out of RAM. There has been a fix to this issue with version 13.4.13-canary.12.

It was caused by exits not cleaning up properly by router-server

I suggest you to upgrade to the latest Next version 14 or if you're too strict on making the change, to upgrade to v13.4.13-canary.12 or above.

like image 94
Haneen Avatar answered Sep 03 '25 00:09

Haneen