-
-
Notifications
You must be signed in to change notification settings - Fork 33.4k
Closed
Closed
Copy link
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.
Description
What is the problem this feature will solve?
Currently, --max-old-space-size requires a fixed memory value in MB. However, in containerized environments (Docker, Kubernetes, etc.), available memory can vary. A percentage-based option would allow Node.js to dynamically adjust its memory usage based on the environment, reducing the risk of OOMKills while optimizing performance.
Why is this needed?
- Improves compatibility with containerized environments like Kubernetes, where memory limits are dynamic.
- Prevents over-allocating memory and OOMKills when limits change.
- Simplifies memory management without requiring external scripts to calculate heap size dynamically.
What is the feature you are proposing to solve the problem?
Introduce a new syntax for --max-old-space-size, allowing it to accept percentages of total system memory (e.g., --max-old-space-size=80%).
For example:
node --max-old-space-size=80% app.js
If the system has 4GB RAM, this would set 3.2GB (80%) as the old space size.
If the system has 1GB RAM, it would set 800MB (80%).
What alternatives have you considered?
- Users must manually set a fixed value.
- Some use external scripts (os.totalmem()) to compute the size dynamically.
staskorz, harikrishna12524, ArthurKaminsky, andreykishtov, michaelper22 and 8 more
Metadata
Metadata
Assignees
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.
Type
Projects
Status
Awaiting Triage