NodeJS-内存不足

时间:2020-11-04 13:41:23

标签: node.js

我的nodejs应用刚刚打印出此错误并崩溃了,我想知道什么是解决此问题的最佳解决方案?

<--- Last few GCs --->

[2558:0x60062c0]  1204618 ms: Mark-sweep 492.0 (495.1) -> 491.8 (495.9) MB, 2532.1 / 0.8 ms  (average mu = 0.092, current mu = 0.009) allocation failure scavenge might not succeed
[2558:0x60062c0]  1206985 ms: Mark-sweep 491.8 (495.9) -> 491.8 (495.9) MB, 2342.2 / 1.6 ms  (average mu = 0.053, current mu = 0.010) allocation failure scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x9fd5f0 node::Abort() [node]
 2: 0x94a45d node::FatalError(char const*, char const*) [node]
 3: 0xb7099e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
 4: 0xb70d17 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
 5: 0xd1a905  [node]
 6: 0xd1b48f  [node]
 7: 0xd294fb v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
 8: 0xd2bcce v8::internal::Heap::CollectAllAvailableGarbage(v8::internal::GarbageCollectionReason) [node]
 9: 0xd2d10b v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
10: 0xcf29e2 v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [node]
11: 0xceec32 v8::internal::FactoryBase<v8::internal::Factory>::AllocateRawArray(int, v8::internal::AllocationType) [node]
12: 0xceece4 v8::internal::FactoryBase<v8::internal::Factory>::NewFixedArrayWithFiller(v8::internal::Handle<v8::internal::Map>, int, v8::internal::Handle<v8::internal::Oddball>, v8::internal::AllocationType) [node]
13: 0xe7c9fe  [node]
14: 0xe7cd94  [node]
15: 0xbdfb49  [node]
16: 0xbe39b6 v8::internal::Builtin_ArrayPush(int, unsigned long*, v8::internal::Isolate*) [node]
17: 0x13cc9d9  [node]
Aborted (core dumped)

1 个答案:

答案 0 :(得分:0)

使用set node_options=--max_old_space_size=SIZE并根据您的要求设置SIZE