Allow setting `--max-heap-size` in `NODE_OPTIONS`
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).
Seems unobjectionable. Pull request welcome. See how --max-old-space-size is handled in src/node_options.cc.
Thanks!
It seems @tannal already opened a pull request. Please let me know if you'll continue working on this or if you need help. 🙏
Hi, do we need any tests for this feature/PR? If so, how or where should I add them?