From 194d1955a77d1011368c8802599a0aa5b122ac4d Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 5 Jul 2018 22:49:55 -0700 Subject: [PATCH] test: fix test-tls-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. PR-URL: https://github.com/nodejs/node/pull/21681 Reviewed-By: Luigi Pinca Reviewed-By: Shingo Inoue --- test/pummel/test-tls-connect-memleak.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/pummel/test-tls-connect-memleak.js b/test/pummel/test-tls-connect-memleak.js index 1ef131d6876ac4..6809b23baf3926 100644 --- a/test/pummel/test-tls-connect-memleak.js +++ b/test/pummel/test-tls-connect-memleak.js @@ -44,9 +44,7 @@ tls.createServer({ { // 2**26 == 64M entries - let junk = [0]; - - for (let i = 0; i < 26; ++i) junk = junk.concat(junk); + const junk = new Array(2 ** 26).fill(0); const options = { rejectUnauthorized: false }; tls.connect(common.PORT, '127.0.0.1', options, function() {