From 7724d38be770d87a7b1a265d25e5f2ff03b57d15 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 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 --- 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)`);