Skip to content

Allow setting --max-heap-size in NODE_OPTIONS #58686

@hpedrorodrigues

Description

@hpedrorodrigues

What is the problem this feature will solve?

V8 supports this flag for a while now (see 9306), and it's even documented under --v8-options (see). However, it's not yet supported to set it with NODE_OPTIONS environment variable as it is for some other similar flags like --max-old-space-size (see).

For instance, a process will fail with the following error if we try to do this:

♪ NODE_OPTIONS='--max-heap-size=750' node
node: --max-heap-size= is not allowed in NODE_OPTIONS

What is the feature you are proposing to solve the problem?

Allow setting --max-heap-size in the NODE_OPTIONS environment variable.

What alternatives have you considered?

At the moment, we are forced to set this flag directly in the command line, but this is a bit inconvenient when we have to manage several services and want to dynamically calculate the maximum heap size in containerized environments (e.g., based on the memory limit imposed for a pod in a Kubernetes cluster).

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Awaiting Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions