Skip to content

Commit

Permalink
test: fix test-tls-connect-memleak
Browse files Browse the repository at this point in the history
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: nodejs#21681
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Shingo Inoue <leko.noor@gmail.com>
  • Loading branch information
Trott committed Jul 9, 2018
1 parent 65208d0 commit e56fec0
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions test/pummel/test-tls-connect-memleak.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit e56fec0

Please sign in to comment.