写了一个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 <JSObject>
1: push(this=000002EC48BF79E1 <JSArray[85096]>)
2: /* anonymous */ [D:\myCode\node.js\????\????\???\analyseDataManager.js:~23] [pc=000003E61D30B6D7](this=000002EC48BF2681 <Interface map = 000000
FD6FC04A39>,line=00000213F0666ED9 <String[455]\: [2020-03-28 20:56:55.247] [INFO] txt - [logger-gamelog][{"appId":"Ph0IGBif7SjPc91K","uuid":80455,"ser
verId":"twoland-g1_gs1-648304","time":158540...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: node_module_register
2: v8::internal::FatalProcessOutOfMemory
3: v8::internal::FatalProcessOutOfMemory
4: v8::internal::Factory::NewUninitializedFixedArray
5: v8::internal::WasmDebugInfo::SetupForTesting
6: v8::internal::WasmDebugInfo::SetupForTesting
7: v8::internal::WasmDebugInfo::SetupForTesting
8: v8::internal::WasmDebugInfo::SetupForTesting
9: v8::internal::SharedFunctionInfo::SetScript
10: v8::internal::JSReceiver::class_name
11: v8::internal::SourcePositionTableIterator::Advance
12: v8::internal::SourcePositionTableIterator::Advance
13: 000003E61D1843C1
解决方案,使用如下命令启动即可:
node --max-old-space-size=4096 demo.js