diff --git a/src/system.js b/src/system.js index 3d2236413..e861703ba 100644 --- a/src/system.js +++ b/src/system.js @@ -219,7 +219,10 @@ async function getMemoryAllocation(limit) { ratio = Math.round(pc * 10) / 10; // a simple ratio } - return Math.round(Math.round(limit * ratio) / 1048576) * 1048576; // nearest MB + const memoryAllocation = Math.round(Math.round(limit * ratio) / 1048576) * 1048576; // nearest MB + + // make sure we never overshoot if the ratio is quite far off (high RAM low swap) + return memoryAllocation > limit ? limit : memoryAllocation; } async function getDiskUsage() {