test: fix test-vm-memleak for high baseline platforms

test-vm-memleak always fails on AIX in CI because the test checks that
total memory consumption is less than 64 Mb, but AIX uses over 100 Mb
just as a baseline. So instead, let's compare the memory consumption to
the baseline and make sure it is within 32 Mb.

PR-URL: https://github.com/nodejs/node/pull/38062
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Ash Cripps <acripps@redhat.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Rich Trott 2021-04-03 08:50:52 -07:00 committed by James M Snell
parent 30d7f05fef
commit a0492ba391
No known key found for this signature in database
GPG Key ID: 7341B15C070877AC

View File

@ -26,6 +26,8 @@ require('../common');
const assert = require('assert'); const assert = require('assert');
const vm = require('vm'); const vm = require('vm');
const baselineRss = process.memoryUsage.rss();
const start = Date.now(); const start = Date.now();
const interval = setInterval(function() { const interval = setInterval(function() {
@ -36,8 +38,8 @@ const interval = setInterval(function() {
global.gc(); global.gc();
const rss = process.memoryUsage.rss(); const rss = process.memoryUsage.rss();
assert.ok(rss < 64 * 1024 * 1024, assert.ok(rss < baselineRss + 32 * 1024 * 1024,
`memory usage: ${rss} (${Math.round(rss / (1024 * 1024))} MB)`); `memory usage: ${rss} baseline: ${baselineRss}`);
// Stop after 5 seconds. // Stop after 5 seconds.
if (Date.now() - start > 5 * 1000) { if (Date.now() - start > 5 * 1000) {