mio MCVE è il seguenteLoop di console.log in nodejs
var i = 0;
for(;;)
console.log(i++)
Quando faccio questo, ad un certo momento, il mio nodejs
si ferma solo roba stampa, dandomi un output simile a questo
[...]
684665
684666
684667
E poi, ho ottenuto questo:
<--- 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
mi chiedevo, cosa si può fare che console.log
potrebbe causare un errore di memoria insufficiente?
Penso che stia traboccando un buffer e deve essere svuotato – Hristo
@Chris Ho modificato il mio post, non era un problema di svuotamento – tforgione
Potrebbe valere la pena aprire un biglietto sul [repository NodeJS] (https://github.com/ nodejs/node/issues) link a questa domanda. –