Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev server is taking too much memory in my Macbook & Windows machine #64183

Closed
sidddev7 opened this issue Apr 8, 2024 · 8 comments
Closed

Dev server is taking too much memory in my Macbook & Windows machine #64183

sidddev7 opened this issue Apr 8, 2024 · 8 comments
Labels
bug Issue was opened via the bug report template. locked

Comments

@sidddev7
Copy link

sidddev7 commented Apr 8, 2024

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/serene-bogdan-v82nfh

To Reproduce

  1. Start The development server
  2. Open the localhost server on browser to start compiling the components
  3. Look at the process utilisation
  4. You will find next-server utilising so much CPU and memory

Current vs. Expected behavior

Current

  • next-server is taking so big memory space in the machine making other process starve for memory like vscode
    Expected Behaviour
  • next-server should not take this much memory of a machine during development
Screenshot 2024-04-08 at 8 45 10 AM

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:19:22 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T8112
Binaries:
  Node: 20.12.1
  npm: 10.5.0
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  next: 14.1.4
  eslint-config-next: 14.1.4
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.4.4
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Not sure

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

Link to the code that reproduces this issue
https://stackblitz.com/edit/stackblitz-starters-8kqwee

To Reproduce
Start The development server
Open the localhost server on browser to start compiling the components
Look at the process utilisation
You will find next-server utilising so much CPU and memory
Current vs. Expected behavior
Current:

next-server is taking so big memory space in the machine making other process starve for memory like vscode
Screenshot 2024-04-08 at 8 45 10 AM
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:19:22 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T8112
Binaries:
Node: 20.12.1
npm: 10.5.0
Yarn: 1.22.22
pnpm: N/A
Relevant Packages:
next: 14.1.4
eslint-config-next: 14.1.4
react: 18.2.0
react-dom: 18.2.0
typescript: 5.4.4
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Not sure

Which stage(s) are affected? (Select all that apply)
next dev (local)

Additional context
I tested it on both Mac and Windows OS and found same behaviour, i am developing a project using next14 and when i save a file, it takes so long to save it on my Brand new macbook pro M2.

Please folks, lets look at this issue as it is hindering the development flow of thousands of developers around the world

@sidddev7 sidddev7 added the bug Issue was opened via the bug report template. label Apr 8, 2024
@piclez
Copy link

piclez commented Apr 9, 2024

I have a bunch of those processes running too but if I close VS Code they go away! I'd like to know how to disable them since it doesn't seem they are running my apps.

@r34son
Copy link
Contributor

r34son commented Apr 10, 2024

#54708

@sidddev7
Copy link
Author

sidddev7 commented Apr 12, 2024

I have created a Bare-starter nextjs app with some dependencies like firebase and antd
https://github.com/sidddev7/pasSync
You can run this code and see the memory utilization of the next-server in any machine, you will notice a sudden hike in usage

One thing i noted
If i use a nextjs app using src directory, then the memory utilization is not too high, but on a project using app directory, it is using high memory

@timneutkens
Copy link
Member

Duplicate of #54708.

App Router bundles node_modules, which Pages Router did not do, which might explain slightly more memory usage depending on the amount of modules, in the reproduction, which unfortunately is not really a reproduction as only the package.json is changed, so running it doesn't hold meaningful data. Looking at the package.json you're likely importing all components of antd though, which would hold meaningful memory usage as it's quite a large library if you're importing all of it.

Going to close it as there's already another issue.

@guillermo-avalos
Copy link

Working on an older project with Pages directory. next-server v14.2.3 idles at around 3 GB of memory, it's nuts. I cannot pin-point the issue yet.

@mooyg
Copy link

mooyg commented Apr 26, 2024

image
Same issue with me too, on Pages router as well takes up way too much resources

@guillermo-avalos
Copy link

I downgraded to v14.1.3 as I have another - much smaller - project that only consumes around 500 MB and it's using that version.. In this bigger project, however, even 14.1.3 idles at 2.3 GB. Both use Pages dir, both have similar backends. The only difference is that this one is much bigger (lots of components).

Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. locked
Projects
None yet
Development

No branches or pull requests

6 participants