huge memory use on build?

See original GitHub issue

The build process of my next.js application seems to use an unusual amount of memory causing the following error when attempting to deploy with now:

> Deploying ~/web/PWA under xxxx@gmail.com
> Using Node.js 8.9.3 (default)
> Ready! https://formulastocks-kixfvvuhaf.now.sh (copied to clipboard) [13s]
> Synced 15 files (27.62KB) [0ms] 
> Initializing…
> Building
> â–˛ npm install
> âś“ Using "package-lock.json"
> ⧗ Installing 57 main dependencies…
> âś“ Installed 1295 modules [10s]
> â–˛ npm run build
> > FormulaStocks@1.0.0 build /home/nowuser/src
> > next build
> > Using external babel configuration
> > Location: "/home/nowuser/src/.babelrc"
> > Using "webpack" config function defined in next.config.js.
> npm ERR! code ELIFECYCLE
> npm ERR! errno 137
> npm ERR! FormulaStocks@1.0.0 build: `next build`
> npm ERR! Exit status 137
> npm ERR! 
> npm ERR! Failed at the FormulaStocks@1.0.0 build script.
> npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
> npm ERR! A complete log of this run can be found in:
> npm ERR!     /home/nowuser/.npm/_logs/2018-01-03T10_55_16_097Z-debug.log
> Error! The build step of your project failed. To retry, run `now --force`.

This was identified in #3407 to be due to the app using way too much memory in the build process and the OSS version of now only allowing 500MB of memory.

Before it was using 1.3GB of memory (when testing the build process locally, as I can’t actually see how much it is on now).

I then tried to move ALL of the non-page files out of the pages folder and into the components folder as I was recommended by @timneutkens and I got the build process down to around 700MB.

However, that’s still unusually high for just 12 routes?

Why does it use so much memory, and any ideas how to reduce this to an acceptable amount? I will need to add more routes in as well, and if it’s already at 700MB even the paid version won’t work for me.

Link to failing build: https://formulastocks-kixfvvuhaf.now.sh

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
MarkLyckcommented, Jan 5, 2018

I also tried removing my _document file, to see if that was causing something that required a lot of memory on all pages. But that didn’t work either…

Any ideas at all what might be causing this!?

0reactions
timneutkenscommented, Mar 16, 2018

Most of the memory use is coming from webpack compiling pages. There’s not that much we can do to optimize it unfortunately. Going to close this as this is on our list of things to tackle 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Windows 10 High Memory Usage [Causes and Solutions]
Windows 10 high memory usage is usually related to RAM and virtual memory. Although memory is tightly connected with CPU and hard drive,...
Read more >
Fix High RAM Memory Usage Issue on Windows 11/10 [10 ...
High Memory Usage is a state where Windows computers' RAM, ROM, or Cache usage grows to an extremely high level. Windows 10 high...
Read more >
How to Fix High Memory Usage in Windows - Make Tech Easier
Open the Task Manager and check any extra programs you aren't using. Right-click and end them. This should immediately reduce the high memory...
Read more >
Using Memory Efficiently When You Build Large Projects
Learn how MSBuild manages memory automatically, such as unloading older versions and retrieving caches, when building large projects.
Read more >
Xcode build causes memory issue | Apple Developer Forums
When performing certain builds on Xcode (for any device, virtual or actual), the memory usage becomes excessive.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found