From 4f387c25cb60ad556fce058546a52f905c3e9d51 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 2 Apr 2021 19:51:15 -0700 Subject: [PATCH] test: fix flaky test-vm-memleak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Force garbage collection so that the memory leak is more easily differentiated from ordinary not-garbage-collected memory. Refs: /~https://github.com/nodejs/node/pull/34289 PR-URL: /~https://github.com/nodejs/node/pull/38054 Reviewed-By: Michaƫl Zasso Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca --- test/pummel/test-vm-memleak.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/pummel/test-vm-memleak.js b/test/pummel/test-vm-memleak.js index 60b021f69906dd..752488e3efc0ed 100644 --- a/test/pummel/test-vm-memleak.js +++ b/test/pummel/test-vm-memleak.js @@ -20,7 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -// Flags: --max_old_space_size=32 +// Flags: --max_old_space_size=32 --expose_gc require('../common'); const assert = require('assert'); @@ -34,6 +34,7 @@ const interval = setInterval(function() { } catch { } + global.gc(); const rss = process.memoryUsage.rss(); assert.ok(rss < 64 * 1024 * 1024, `memory usage: ${rss} (${Math.round(rss / (1024 * 1024))} MB)`);