diff options
author | Rich Trott <rtrott@gmail.com> | 2018-07-05 22:49:55 -0700 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2018-07-09 15:40:03 -0700 |
commit | e56fec07225dab2669e3345dcf783a18ca03ed43 (patch) | |
tree | e74a3fca0c89f54922d8c848bd7cdb7b427fc277 /test/pummel | |
parent | 65208d038e76cf24ba1afe6768d7b053b3bbf3f3 (diff) | |
download | android-node-v8-e56fec07225dab2669e3345dcf783a18ca03ed43.tar.gz android-node-v8-e56fec07225dab2669e3345dcf783a18ca03ed43.tar.bz2 android-node-v8-e56fec07225dab2669e3345dcf783a18ca03ed43.zip |
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 <luigipinca@gmail.com>
Reviewed-By: Shingo Inoue <leko.noor@gmail.com>
Diffstat (limited to 'test/pummel')
-rw-r--r-- | test/pummel/test-tls-connect-memleak.js | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/test/pummel/test-tls-connect-memleak.js b/test/pummel/test-tls-connect-memleak.js index 1ef131d687..6809b23baf 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() { |