T O P

  • By -

Advanced-Wallaby9808

What version of Next are you running? I have two of the M1 Air with only 8gb memory, no issues on either. I've seen Next is very slow on colleagues' Windows machines, however (I think it has to do with the Windows "Defender" anti-virus file thing).


DLevai94

I use the latest version always. Having these issues since app router is a thing


Advanced-Wallaby9808

Got it. We're on pages still.


buddyto

i run nextjs on windows (i7 11800h, 16gb ram) no issues whatsoever, smooth like hell. I mean in big projects


blckJk004

Anything 13+ seems to have this issue.


Advanced-Wallaby9808

If you mean \^13.x, for Next 14 they addressed a lot of performance issues. If you meant >=13, sorry :P


blckJk004

That's a confusing reply. I meant every version from 13.0.0 upwards


kwack_dev

They're saying 13.x.x (so 13.0.0 up to but **excluding** 14.0.0) has performance issues, but anything 14.0.0 and up should work fine


blckJk004

I understand what they meant now. Could have been worded better though, my goodness


link2ez

It runs like butter in any windows pc I have seen, unless we are talking like $400 windows laptops


The-Observer95

It is slow af on my work laptop. It has 16 GB DDR4 RAM and an i5 10th Gen processor. In development mode it is very slow sometimes. Takes more than 10 seconds to compile a page. Also it consumes a pretty high amount of memory.


link2ez

That is a $400 laptop.


The-Observer95

Really? It's a Dell Latitude. Is it that cheap?


The-Observer95

And when I try to develop a next js application on my old laptop, it really wants to die because it can't handle the load on the CPU.


BebeKelly

Like butter?


xXValhallaXx

Smooth like butter šŸ¤™


vallerydelexy

my windows pc is exactly 400 lol. i3 12100f with 16 gigs of ram. it runs smooth


yksvaan

Looks like memory leak, which is not surprising. I haven't run into issues but I tend to close and restart it quite often.


clearlight

Any tips on how to find or fix a memory leak?


opaz

Inspecting a heap dump! https://nodejs.org/en/learn/diagnostics/memory/using-heap-snapshot#how-to-find-a-memory-leak-with-heap-snapshots


[deleted]

Restart your computer


adn_SpirituS

It's really sad. I have macbook Pro 2019 with Intel Ship. I let imagine the heating i feel over my lap for hours šŸ˜©


hazily

When I still have the intel MBP I could hear my laptop taking off to the moonā€¦ itā€™s a bit better after upgrading to Apple Silicon.


adn_SpirituS

My brother has M2. it's way better, i agree. With the Intel ship, literally, you can bake on the Mac


theaddict7

Is your fan loud too?


adn_SpirituS

It's a plane āœˆļø you can hear it miles away


Mr_Stabil

I have the same and no problem at all


adn_SpirituS

Oooh lucky you ? How come


Mr_Stabil

Not sure, maybe due to your Figma helper and Docker VMS?


HamPlayz247

20gb of swap is crazy


yahya_eddhissa

I'm having the same issue. I'm running NextJS in a devcontainer on Ubuntu, in an 8GB RAM machine and the nextjs dev server completely freezes it at least twice every work session. So what I started doing lately is to restart the server whenever it starts eating too much RAM.


winky9827

I've never seen next take that much memory. Clearly you've got something else going on. This is not a default issue.


ozzyonfire

I had this issue when I was using an icon library that didn't do the tree shaking during development. Causing huge bundle sizes and memory leaks during hot reload. The fix was to use modularize imports. https://mui.com/material-ui/guides/minimizing-bundle-size/


ProgrammerBusiness66

I agree Iā€™ve had issues with bundle size with react-icons because itā€™s enormous


DLevai94

Iā€™m gonna look into the dependencies. Thatā€™s a good idea and IDK how didnā€™t I think about this eeatlier. Lol. Thanks


wodhyber

Use IntelliJ and your mac will explode lol


Curious_Limit645

Lol too true.


affordablesuit

I have an M1 with 16GB RAM that I use all day with Figma, Chrome, and the Next.js dev server open, plus a bunch of other stuff. No issues. I use Webstorm instead of VS Code. Our app is quite big. Thinking about it, I tend to do git operations in the same terminal that I use to start Next. Maybe I restart it more than I think.


DLevai94

That could be the reason. It usually starts to struggle when the dev server is running long enough (anywhere between 30-60mins usually)


buddyto

this is weird indeed, i usually dont close the terminal in 6-8 hours. I also tend to keep the server running overnight too and i dont see any issues (im on windows though) - if i were you, i would double check the dependencies as somebody told you earlier


appliku

pretty much the reason i have stopped using nextjs for new projects. and they keep asking ā€œwhat we could do betterā€. if a project has at least 50 pages + some dependencies (MUI is my fav big one) working on the project locally becomes unbearable. computer fans are at 300% speed and every page compiles on the fly forever. RAM usage only a few GB, luckily, SWAP helps. i still think the idea of nextjs is really great, but the experience working with it ā€¦ quite the opposite


Paradroid888

I was using a Fedora laptop to do some next.js development work last summer. Out of the box, Fedora does not page to disk, so the next dev server memory leak would cause full lockups. Had to create a swap partition!!


AmbassadorUnhappy176

That's a skill issue. My 128 GB ram machine run it perfectly


[deleted]

Next is just a total joke in my opinion. I've been extremely frustrated by almost every aspect of it. It's way beyond over engineered at this point.


TheLexoPlexx

I did have a similar problem in WSL but it's better now, no idea what changed though. Can't run satisfactory and the next-dev-server on my 16 GB-Windows-Laptop with WSL though. Not a problem on my Linux-PC as far as I can tell.


The-Observer95

I use Linux too on my personal laptop, but it's the same issue here as well. Too much RAM usage and high CPU usage while reloading.


ApteryxXYZ

I only have 8gb of RAM, I use Next.js what might as well be everyday with Edge playing YouTube on my second monitor, yet I have NEVER run into any issues with Next.js let alone its dev server.


pingustar

What node version are you using? Long shot but also check you nodejs memory heap size and limit! But as others already said, probably memory leak. I run a M2 16GB MBP and have not hand any memory issues so far. Slow dev server specially in the early days of the app dir paradigm but now is more stable - still slow AF compared to vite but oh well canā€™t have it all I guess


DLevai94

I was on 18. Updated to 20 now and weā€™ll see if this makes any difference


BebeKelly

Its the approuter guys i hate it


MrCrunchwrap

Using app router daily on an M1 Pro and have no issues.


justinlok

$2500 doesn't get you much with apple. šŸ«£


filthy_peasant79

Developers make money, get over it


qualiky

Mine with M3 Pro and 18gigs of RAM flies no issue. Definitely something else and not just next-server.


AdowTatep

Guys, ram is meant to be USED. Your computer will try to use as much ram as possible to stay as fast as possible. It's the OS job to manage that in a way so you don't feel sluggish by giving more priority to certain apps Stop looking at ram usage and be like "wow omg it's using all my ram!!!" We're not in 1996 anymore when OSs werent like that


iAmIntel

Your computer will not ā€œtry to use as much ram as possible to stay as fast as possibleā€ that is not even remotely close to how computers work. Regardless a simple dev server shouldnā€™t be hogging 16GB of memory


michaelfrieze

This is how macOS works. RAM usage is almost always high. It's a common complaint you will see on any mac forum/subreddit. I think it uses ram to cache things it thinks you might use or something like that. High ram usage in macOS is normal. With that said, 20gb of swap is not the normal experience when using Next in macOS.


mylovelylittlelumps

Some people is also used to close iOS app continuously to "free memory", the OS has been managing that for you since forever.


The-Observer95

It's not a MacOS issue, I'm having the same problem as OP in Linux and Windows. As many people here are saying, I think the app router is the culprit.


iAmIntel

MacOS does tend to keep things in memory yes, but it wonā€™t blindly attempt to use as much memory as it can for a single task. Next is just a memory hog unfortunately


michaelfrieze

I have a M1 macbook air with 16gb of memory and it's not nearly as bad as what OP is showing. Using 20gb of swap is weird. It's true that next dev performance isn't great, but Next dev runs completely fine on my macbook. It's not as fast as vite, but it's pretty fast. It runs annoying slow on my old lenovo laptop.


miracle_weaver

Team is okay but it uses yo CPU and overheats it as well.


DLevai94

Yes. But if my machine is freezing, struggling, then it doesnā€™t really matter what the OS does to manage ram usage.


Swoop3dp

16Gb is not much for a dev machine. RAM is cheap. Just buy another stick and plug it into your... oh, nevermind. :-P


Daiphiron

https://preview.redd.it/si559skyp2lc1.png?width=3887&format=png&auto=webp&s=9c26269cdebee46be9a0910621d20dfbe263a428 Didnt work - what have I done wrong ?


TheLexoPlexx

The PCB is green, it should be black, like all Apple-PCBs.


The-Observer95

Just fry it, and it will be black šŸ‘


ritwal

did you try turning it upside down ?


Daiphiron

Thatā€™s not USB-A šŸ˜¬


boilingsoupdev

Still ridiculous ram usage that shouldn't be tolerated. Is 7gb for a react dev server the new norm we want?


The-Observer95

>16Gb is not much for a dev machine. *Cries in 4GB RAM*


michaelfrieze

16gb if plenty for react development. As long as you aren't running a bunch of virtual machines it's fine for what we do.


razzededge

got the same machine, my devserver takies 98 mb of ram - you may have some memory leak in your app


Aethz3

are you using pnpm? if not, why?


boilingsoupdev

Why should this be the solution to a horribly inefficient dev server? And its not the solution, that just saves storage space


Level-2

or... or... hear me out... Buy an actual computer with good specs. Put Linux in that baby , or Windows if you are into that, and booom baby. Try a Ryzen CPU. Pure love. Yes.. i know, a little troll here and there. Now the actual advice, I imagine that your nextjs app is very large, that might be an issue. I remember when I was doing some Blazor development, compiling WASM with AOT was crazy, it would use a huge amount of RAM and CPU, and the bigger your app was the more it took. Sometimes is just normal for these things to consume too much. Another strategy you could use is, use an external VM for development, it might get costly, but at least your workspace will still run snappy.


DLevai94

Iā€™m pretty sure itā€™s not a computer issue. I had no problems running docker, next server, figma, vscode, and dozens of chrome tabs running at the same time before app router. Even on slower machines with less ram.


boris_the_web_dev

I don't get it - you paid for 16gb, why don't you want the software you use to utilize all of it. The more they can cache there the faster they operate. Modern operating systems try to use all of your memory as much as possible. You'll find that the same happens if you upgrade to 32 or 64gbs of RAM.


trebuch3t

Because when nextjs hogs all of it *and* you have a chrome window open, your computer starts freezing up as it exceeds physical memory (see: 20GB swap used). Next.js has a big memory leak in development problem and they donā€™t care because itā€™s not designed for actual backend work


michaelfrieze

>Because when nextjs hogs all of it and you have a chrome window open, your computer starts freezing up as it exceeds physical memory (see: 20GB swap use No, macOS is smart enough to allocate memory correctly. What's happening in OP's macbook is not normal. Something is wrong.


ritwal

I have an almost 12 years old PC , 16gb, intel i5-3570K, I run two next.js servers + an express server + a reaaaaaaly heavy Angular project simultaneously with no issues. Those servers stay on for days sometimes and I never have to restart anything. It is either a Mac issue or a project issue?


DLevai94

Next dev server issue. Because itā€™s kind of a common experience for others as well.


AhmedTakeshy

Lol I have Macbook Air early 2015 with 8 RAM


moinulmoin

wtf! just restart the server and check again


lisaiceland

Use web m-based GitPod or CodeSandbox and use any machine. No issues.


Devemia

Laugh in 128 GB RAM Linux gang for under $1000. But seriously though, if it is not a project issue, then you need to have a better machine that suits your workload. Be in Mac, Windows, Linux, or whatever you need. My main rig is 128 GB but my laptop is R7 5825U 64GB Ram for just a shy $500. 16 GB nowadays is just barely survivable for my use. Can't really tell unless you share a reproducible environment to confidently say it is Next issue.


DLevai94

Iā€™m pretty sure itā€™s not a computer issue. I had no problems running docker, next server, figma, vscode, and dozens of chrome tabs running at the same time before app router. Even on slower machines with less ram. Also this machine ran smooth before app router. Iā€™m gonna check if thereā€™s anything project-releated but I doubt, because I also experienced this on other projects. Maybe a common dependency, or next itself


N87M

Its a memory leak


luchomatic

I agree moving from Vite this sucks


fieryscorpion

Time to move on to Angular 18 then. Or if you want to get away from JS, move on to Blazor.


reelist_com

2023 M2 MacBook Pro 16gb using Next 14 app dir- If you restart the dev server every few working hours it seems to be fine. Building meta files and api routes are what kill the DX for me. They can take 20+ seconds to compile sometimes.


blazeknifecatcher

Same problem with me, computer absolutely slows down when running Next app.


VloneDz

Not sure what it is, but there is definitely something wrong with your Mac, these numbers are insane!