Skip to content

Commit 194d195

Browse files
Trotttargos
authored andcommitted
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: #21681 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Shingo Inoue <[email protected]>
1 parent cd77d87 commit 194d195

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

test/pummel/test-tls-connect-memleak.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ tls.createServer({
4444

4545
{
4646
// 2**26 == 64M entries
47-
let junk = [0];
48-
49-
for (let i = 0; i < 26; ++i) junk = junk.concat(junk);
47+
const junk = new Array(2 ** 26).fill(0);
5048

5149
const options = { rejectUnauthorized: false };
5250
tls.connect(common.PORT, '127.0.0.1', options, function() {

0 commit comments

Comments
 (0)