-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
Closed
Labels
duplicateIssues and PRs that are duplicates of other issues or PRs.Issues and PRs that are duplicates of other issues or PRs.invalidIssues and PRs that are invalid.Issues and PRs that are invalid.memoryIssues and PRs related to the memory management or memory footprint.Issues and PRs related to the memory management or memory footprint.questionIssues that look for answers.Issues that look for answers.
Description
The other day, I went through something that I didn't understand in node.
var i = 0;
for(;;)
console.log(i++)
When I do this, at a certain moment, my nodejs just stops printing stuff, giving me an output that looks like this
[...]
684665
684666
684667
And after a while, I got this :
<--- Last few GCs --->
69097 ms: Scavenge 1397.2 (1456.7) -> 1397.2 (1456.7) MB, 0.8 / 0 ms (+ 1.7 ms in 1 steps since last GC) [allocation failure] [incremental marking delaying mark-sweep].
70462 ms: Mark-sweep 1397.2 (1456.7) -> 1396.0 (1456.7) MB, 1364.9 / 0 ms (+ 2.8 ms in 2 steps since start of marking, biggest step 1.7 ms) [last resort gc].
71833 ms: Mark-sweep 1396.0 (1456.7) -> 1397.1 (1456.7) MB, 1370.2 / 0 ms [last resort gc].
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0xcdf79d37399 <JS Object>
1: formatPrimitive(aka formatPrimitive) [util.js:~411] [pc=0x634d9f4113f] (this=0xcdf79d04131 <undefined>,ctx=0x17b18f4d561 <an Object with map 0x32fd25043ef9>,value=16248021)
2: formatValue(aka formatValue) [util.js:223] [pc=0x634d9f1fdbb] (this=0xcdf79d04131 <undefined>,ctx=0x17b18f4d561 <an Object with map 0x32fd25043ef9>,value=16248021,recurseTimes=2)
3: inspect(aka inspect) [uti...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
[1] 19446 abort (core dumped) node
I was wondering, what can console.log do that could lead to an out of memory error ?
At first, I asked that question on stackoverflow, but someone suggested that I create an issue here, and I thought it could be a good idea.
What do you think about this ?
EDIT : Apparently, it has also be discussed here
Metadata
Metadata
Assignees
Labels
duplicateIssues and PRs that are duplicates of other issues or PRs.Issues and PRs that are duplicates of other issues or PRs.invalidIssues and PRs that are invalid.Issues and PRs that are invalid.memoryIssues and PRs related to the memory management or memory footprint.Issues and PRs related to the memory management or memory footprint.questionIssues that look for answers.Issues that look for answers.