Skip to content

Commit 66dc883

Browse files
authored
Merge pull request #1826 from github/henrymercer/increase-reserved-scaling-factor
Increase scaling factor for reserved RAM to 5%
2 parents 1f63aba + 2203178 commit 66dc883

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

lib/util.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/util.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/util.test.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/util.test.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/util.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ const GET_MEMORY_FLAG_TESTS = [
5353
totalMemoryMb: 64 * 1024,
5454
platform: "linux",
5555
expectedMemoryValue: 63 * 1024,
56-
expectedMemoryValueWithScaling: 63078, // Math.floor(1024 * (64 - 1 - 0.025 * (64 - 8)))
56+
expectedMemoryValueWithScaling: 61644, // Math.floor(1024 * (64 - 1 - 0.05 * (64 - 8)))
5757
},
5858
{
5959
input: undefined,
6060
totalMemoryMb: 64 * 1024,
6161
platform: "win32",
6262
expectedMemoryValue: 62.5 * 1024,
63-
expectedMemoryValueWithScaling: 62566, // Math.floor(1024 * (64 - 1.5 - 0.025 * (64 - 8)))
63+
expectedMemoryValueWithScaling: 61132, // Math.floor(1024 * (64 - 1.5 - 0.05 * (64 - 8)))
6464
},
6565
];
6666

src/util.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ function getSystemReservedMemoryMegaBytes(
160160
const fixedAmount = 1024 * (platform === "win32" ? 1.5 : 1);
161161

162162
if (isScalingReservedRamEnabled) {
163-
// Reserve an additional 2.5% of the amount of memory above 8 GB, since the amount used by
164-
// the kernel for page tables scales with the size of physical memory.
165-
const scaledAmount = 0.025 * Math.max(totalMemoryMegaBytes - 8 * 1024, 0);
163+
// Reserve an additional 5% of the amount of memory above 8 GB, since the amount used by the
164+
// kernel for page tables scales with the size of physical memory.
165+
const scaledAmount = 0.05 * Math.max(totalMemoryMegaBytes - 8 * 1024, 0);
166166
return fixedAmount + scaledAmount;
167167
} else {
168168
return fixedAmount;

0 commit comments

Comments
 (0)