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

Node 12 dynamic heap size maxes out at 2048MB #28202

Closed
filipesilva opened this issue Jun 13, 2019 · 4 comments
Closed

Node 12 dynamic heap size maxes out at 2048MB #28202

filipesilva opened this issue Jun 13, 2019 · 4 comments

Comments

@filipesilva
Copy link

  • Version: 12.4.0
  • Platform: Linux
  • Subsystem:

Hi there. The Node 12 announcement contained a section about dynamic heap limits:

Properly configure default heap limits

This update will configure the JavaScript heap size based on available memory instead of using defaults that were set by V8 for use with browsers. In previous releases, unless configured, V8 defaulted to limiting the max heap size to 700 MB or 1400MB on 32 and 64-bit platforms respectively. Configuring the heap size based on available memory ensures that Node.js does not try to use more memory than is available and terminating when its memory is exhausted.

This is particularly useful when processing large data-sets. As before, it will still be possible to set — max-old-space-size to use a different limit if the default is not appropriate for your application.

The "will configure the JavaScript heap size based on available memory" part made me think the new limit was always relative to the total available memory. But as far as we can tell in angular/angular-cli#13734 (comment), there's still a default maximum at 2048MB.

Is this new default maximum intended? The blog post doesn't mention any maximum, just that it's based on available memory.

@sam-github
Copy link
Contributor

Is #25576 (comment) informative?

@MLoughry
Copy link

It's informative as to how it's currently implemented, but I'm not sure I gleaned enough (nor know enough) about V8 to understand why.

Is there a reason the ceiling can't be raised further? Or even dynamically changed at runtime with something like v8.setFlagsFromString()?

@joyeecheung
Copy link
Member

The current default comes from V8 so it would be more effective to ask in places like https://groups.google.com/forum/#!forum/v8-users

@filipesilva
Copy link
Author

@sam-github it is very informative, thank you. This definitely is intentional. The comment also mentions that the maximum is likely too low and should be reviewed:

With this spelled out, it is worth pausing and thinking about this more deeply. I do think we need change the default on large machines. I routinely see workloads where the job fails with 'out of memory' when there clearly is enough memory available.

@joyeecheung #25576 (comment) is altering the limit to not be the default v8 one though. So I feel this is actually the right project to discuss the current limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants