Skip to content

Commit

Permalink
test: fix pummel/test-net-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: #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>
  • Loading branch information
Trott authored and targos committed Jul 9, 2018
1 parent 034fe19 commit 24f649c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions test/pummel/test-net-connect-memleak.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ let before = 0;
{
// 2**26 == 64M entries
global.gc();
let junk = [0];
for (let i = 0; i < 26; ++i) junk = junk.concat(junk);
const junk = new Array(2 ** 26).fill(0);
before = process.memoryUsage().rss;

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

0 comments on commit 24f649c

Please sign in to comment.