Node内存异常 FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

写了一个node程序,使用启动命令:node demo.js,报出如下错误:

<--- Last few GCs --->

[68628:00000000003E0790]    23821 ms: Mark-sweep 1611.2 (1799.5) -> 1611.0 (1801.0) MB, 88.9 / 0.0 ms  allocation failure GC in old space requested
[68628:00000000003E0790]    23914 ms: Mark-sweep 1611.0 (1801.0) -> 1611.0 (1766.5) MB, 91.6 / 0.0 ms  last resort GC in old space requested
[68628:00000000003E0790]    24005 ms: Mark-sweep 1611.0 (1766.5) -> 1611.0 (1761.5) MB, 90.8 / 0.0 ms  last resort GC in old space requested


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 000001BE2A2A57C1 
    1: push(this=000002EC48BF79E1 )
    2: /* anonymous */ [D:\myCode\node.js\????\????\???\analyseDataManager.js:~23] [pc=000003E61D30B6D7](this=000002EC48BF2681 ,line=00000213F0666ED9 

解决方案,使用如下命令启动即可:

node --max-old-space-size=4096 demo.js

 

你可能感兴趣的:(node)