From 45412e079aa8f02e98dfdc4b91a3ec984d575d87 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 4 Jul 2018 09:55:55 -0700 Subject: [PATCH] test: fix pummel/test-net-connect-memleak A loop that generates a long array is resulting in a RangeError. Moving to Array.prototype.fill() along with the ** operator instead of using a loop fixes the issue. --- test/pummel/test-net-connect-memleak.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/pummel/test-net-connect-memleak.js b/test/pummel/test-net-connect-memleak.js index b6a31daed230d5..7546a6caeb62ea 100644 --- a/test/pummel/test-net-connect-memleak.js +++ b/test/pummel/test-net-connect-memleak.js @@ -37,8 +37,7 @@ let before = 0; { // 2**26 == 64M entries global.gc(); - let junk = [0]; - for (let i = 0; i < 26; ++i) junk = junk.concat(junk); + const junk = new Array(2 ** 26).fill(0); before = process.memoryUsage().rss; net.createConnection(common.PORT, '127.0.0.1', function() {