diff options
author | Rich Trott <rtrott@gmail.com> | 2018-07-04 09:55:55 -0700 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2018-07-06 15:28:49 -0700 |
commit | ff958ad0c046294f45c913ad721964980a45e0b8 (patch) | |
tree | e6a6a1b70a0b53ecdbe451536ce744342223c879 /test | |
parent | 19795d83833de7489afec583f8773ee9c0452f70 (diff) | |
download | android-node-v8-ff958ad0c046294f45c913ad721964980a45e0b8.tar.gz android-node-v8-ff958ad0c046294f45c913ad721964980a45e0b8.tar.bz2 android-node-v8-ff958ad0c046294f45c913ad721964980a45e0b8.zip |
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.
PR-URL: https://github.com/nodejs/node/pull/21658
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/pummel/test-net-connect-memleak.js | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/test/pummel/test-net-connect-memleak.js b/test/pummel/test-net-connect-memleak.js index b6a31daed2..7546a6caeb 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() { |