0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 15:06:33 +01:00

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>
This commit is contained in:
Rich Trott 2018-07-05 22:49:55 -07:00
parent 65208d038e
commit e56fec0722

View File

@ -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() {