-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
Closed
Labels
memoryIssues and PRs related to the memory management or memory footprint.Issues and PRs related to the memory management or memory footprint.v8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency.
Description
Version: 4.2.1, 5.1.10 confirmed.
Platform: at least Windows 10 and Linux
`Following code reproduces error:
'use strict';
const s = new WeakSet();
let j = 0;
function f(){
for (let i = 0 ; i<100000; i++) {
s.add({});
}
console.log(`${j++} :${0|(process.memoryUsage().heapUsed/(1024*1024))}MB`);
return Promise.resolve(null).then(f);
}
f();
It ends with following output
...
110 :853MB
<--- Last few GCs --->
10993 ms: Scavenge 825.2 (856.1) -> 823.2 (863.1) MB, 49.7 / 0 ms [allocation failure].
11126 ms: Scavenge 832.1 (863.1) -> 830.1 (870.1) MB, 43.4 / 0 ms [allocation failure].
11255 ms: Scavenge 839.0 (870.1) -> 837.0 (877.1) MB, 44.6 / 0 ms [allocation failure].
11390 ms: Scavenge 845.8 (877.1) -> 843.9 (884.1) MB, 47.5 / 0 ms [allocation failure].
11517 ms: Scavenge 852.7 (884.1) -> 850.8 (891.1) MB, 42.5 / 0 ms [allocation failure].
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0000029D869E3AD1 <JS Object>
1: add [native weak-collection.js:~92] [pc=0000036347B55F9B] (this=000003208D656691 <JS WeakSet>,k=00000167E7F946E9 <an Object with map 0000027C0AC172F1>)
2: f(aka f) [C:\Users\michal.wadas\Documents\test_gc.js:7] [pc=0000036347B536C1] (this=0000029D86904189 <undefined>)
3: arguments adaptor frame: 1->0
4: /* anonymous */(aka /* anonymous */) [native promise.js:221] [pc=000003...
Objects are properly garbage collected in Chrome 49 (process.memoryUsage().heapUsed
is changed to performance.memory.usedJSHeapSize
).
Source: StackOverflow question.
Metadata
Metadata
Assignees
Labels
memoryIssues and PRs related to the memory management or memory footprint.Issues and PRs related to the memory management or memory footprint.v8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency.