Skip to content

Commit 24f649c

Browse files
Trotttargos
authored andcommitted
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: #21658 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent 034fe19 commit 24f649c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ let before = 0;
3737
{
3838
// 2**26 == 64M entries
3939
global.gc();
40-
let junk = [0];
41-
for (let i = 0; i < 26; ++i) junk = junk.concat(junk);
40+
const junk = new Array(2 ** 26).fill(0);
4241
before = process.memoryUsage().rss;
4342

4443
net.createConnection(common.PORT, '127.0.0.1', function() {

0 commit comments

Comments
 (0)