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 <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
1 parent 034fe19 commit 24f649c

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

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

Lines changed: 1 addition & 2 deletions
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-
letjunk=[0];
41-
for(leti=0;i<26;++i)junk=junk.concat(junk);
40+
constjunk=newArray(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)