Increase the default amount of RAM reserved for the OS

Mitigation for OOM errors (137/SIGKILL) seen by users when we overcommit the available memory.
For Unix, reserve 1GB.
For Windows, reserve 1.5GB, as the OS needs more memory and estimates inaccurately.
This commit is contained in:
Aditya Sharad 2021-02-16 15:04:38 -08:00
parent 88714e3a60
commit 4c94e29f1b
No known key found for this signature in database
GPG key ID: 66D1E528054C320C
6 changed files with 39 additions and 12 deletions

View file

@ -24,10 +24,11 @@ test("getToolNames", (t) => {
test("getMemoryFlag() should return the correct --ram flag", (t) => {
const totalMem = Math.floor(os.totalmem() / (1024 * 1024));
const expectedThreshold = process.platform === "win32" ? 1536 : 1024;
const tests = [
[undefined, `--ram=${totalMem - 256}`],
["", `--ram=${totalMem - 256}`],
[undefined, `--ram=${totalMem - expectedThreshold}`],
["", `--ram=${totalMem - expectedThreshold}`],
["512", "--ram=512"],
];