mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
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>
This commit is contained in:
parent
2baf025545
commit
51fd5db4c1
1 changed files with 3 additions and 3 deletions
|
@ -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()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue