Hey there folks, is there any way we could cap the limit on the amount of memory the dev server process could take in MacOS?
Currently it sometimes takes over 12gbs after around 30mins of initial startup, makes the whole system slow, the next.js dev server has decent performance but then compromises on the entire performance of the system.
I’m running this project, and I’ve tried --turbo for running it using Turbopack, but for some reason our project doesn’t start up in that case and doesn’t load at all…
Hi how are you running the project you linked? I noticed in their contributing docs that 12GB is the recommended memory - are you running the full Docker compose stack based on those docs?
No no, I’m not using docker to do this, I’m just running the project locally, is the Next.js dev server taking 12gb normal though? If so, then is there no way I could cap the memory it takes?
Full disclosure, I’m a maintainer at this project, we added that in the docs since Next.js takes a ton of memory.
Hey @pbzona, please do let me know how we could further debug this, thanks!
We have barrel files across our project, which we’ve fixed using this guide, but still doesn’t seem to fix things, would be awesome if you folks could point me in the right direction
Hi, definitely happy to help although I’m not sure I understand your setup. Can you explain how you’re starting the project exactly? Looking through the contributing docs it looks like the local installation is based on Docker Compose. Are you running just the Next.js app in isolation? If so, are there any special instructions to do that since it depends on the other containers? How are you measuring memory usage?
In theory you can use any profiling tool that works with Node here. In practice, figuring out how and where to inject it isn’t always super straightforward.
To answer your question “is it normal” - it could be, but 12GB does sound high. If you can share more about your dev environment I can recommend some different ways to profile.
Yup you can run things via docker compose, but I’ve set it up locally and run it without docker i.e. directly in my shell by doing next dev. (running it in docker makes the next.js HMR even slower)
I’m measuring the performance actually from the activity monitor (next-server process)
So yes, I’m running the Next.js app in isolation
To run it, no special instructions, we’re making the local dev setup docs better, but you’d just need to setup some env variables and run the apiserver to get things going, let me know if you’d want to try it out yourself and I could share a doc here that goes through the entire setup process)
Let me know if you want some profiling outputs/etc and I’ll share them with you!