1

My nodejs app just printed out this error and crashed I am wondering what is the best solution to fix the issue?

<--- 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)

RussellHarrower
  • 6,470
  • 21
  • 102
  • 204
  • 1
    Does this answer your question? [Node.js heap out of memory](https://stackoverflow.com/questions/38558989/node-js-heap-out-of-memory) – Manuel Spigolon Nov 04 '20 at 13:50
  • 1
    use `--max-old-space-size=SIZE` option argument by replace the size that you think is needed – Heartbit Nov 04 '20 at 13:58
  • You should first check what section of your program is eating up memory and does it need that much. If you don't think it should, then you should try to optimize your code otherwise go for custom heap size. – Pratyush Sharma Nov 04 '20 at 15:54

1 Answers1

1

use set node_options=--max_old_space_size=SIZE and set SIZE as per your requirement

Simran
  • 98
  • 6