diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2022-04-11 21:35:53 +0300 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2022-04-28 07:56:13 +0300 |
commit | d311916f376f9ce07cbd93086db4560b59827259 (patch) | |
tree | d58c0fa45e650d7fa2392ab50aab5272c5a08547 /test | |
parent | 6bd24204ea14a87046ad845ad34060f0f371b522 (diff) |
test: fix calculations in test-worker-resource-limits
The heap size limit should be the sum of old generation and young
generation size limits, and does not solely depend on the limit
of the old generation.
PR-URL: https://github.com/nodejs/node/pull/42702
Refs: https://github.com/nodejs/node/issues/35711
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/parallel/test-worker-resource-limits.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/test/parallel/test-worker-resource-limits.js b/test/parallel/test-worker-resource-limits.js index ffda452f6c6..f79c31b2a18 100644 --- a/test/parallel/test-worker-resource-limits.js +++ b/test/parallel/test-worker-resource-limits.js @@ -35,10 +35,10 @@ if (!process.env.HAS_STARTED_WORKER) { assert.deepStrictEqual(resourceLimits, testResourceLimits); const array = []; while (true) { - // Leave 10% wiggle room here, and 20% on debug builds. - const wiggleRoom = common.buildType === 'Release' ? 1.1 : 1.2; const usedMB = v8.getHeapStatistics().used_heap_size / 1024 / 1024; - assert(usedMB < resourceLimits.maxOldGenerationSizeMb * wiggleRoom); + const maxReservedSize = resourceLimits.maxOldGenerationSizeMb + + resourceLimits.maxYoungGenerationSizeMb; + assert(usedMB < maxReservedSize); let seenSpaces = 0; for (const { space_name, space_size } of v8.getHeapSpaceStatistics()) { |