Languages

Node.js throws error: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

9 points
Asked by:
Diana
720

Why does my application get error:

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

Stack trace:

<--- Last few GCs --->
na[7156:00000170211477B0]    57598 ms: Mark-sweep (reduce) 29.2 (31.6) -> 29.2 (31.3) MB, 32.9 / 0.0 ms  (+ 0.0 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 33 ms) (average mu = 0.277, current mu = 0.307) alloca[7156:00000170211477B0]    57628 ms: Mark-sweep (reduce) 30.3 (31.3) -> 29.4 (31.6) MB, 13.8 / 0.0 ms  (+ 10.4 ms in 16 steps since start of marking, biggest step 1.0 ms, walltime since start of marking 29 ms) (average mu = 0.235, current mu = 0.177) task

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 00007FF7DEB886BF v8::internal::Isolate::ArchiveSpacePerThread+4719
 2: 00007FF7DEB1B246 v8::internal::wasm::WasmCode::safepoint_table_offset+67414
 3: 00007FF7DEB1C126 node::OnFatalError+294
 4: 00007FF7DF4943BE v8::Isolate::ReportExternalAllocationLimitReached+94
 5: 00007FF7DF47B35D v8::SharedArrayBuffer::Externalize+781
 6: 00007FF7DF2FBB9C v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1452
 7: 00007FF7DF308634 v8::internal::Heap::PublishPendingAllocations+1092
 8: 00007FF7DF3054BD v8::internal::Heap::PageFlagsAreConsistent+2861
 9: 00007FF7DF2F896F v8::internal::Heap::CollectGarbage+1871
10: 00007FF7DF2FBCA7 v8::internal::Heap::FinalizeIncrementalMarkingAtomically+263
11: 00007FF7DF2F112B v8::base::CPU::is_fp64_mode+491
12: 00007FF7DEAAD61F v8::CFunction::ReturnInfo+17311
13: 00007FF7DEAABE46 v8::CFunction::ReturnInfo+11206
14: 00007FF7DEBE835B uv_async_send+331
15: 00007FF7DEBE7AEC uv_loop_init+1292
16: 00007FF7DEBE7C8A uv_run+202
17: 00007FF7DEBB6F64 node::SpinEventLoop+308
18: 00007FF7DEAD3F53 v8::internal::UnoptimizedCompilationInfo::feedback_vector_spec+52995
19: 00007FF7DEB4E387 node::Start+215
20: 00007FF7DE97822C RC4_options+346412
21: 00007FF7DFA3931C v8::internal::compiler::RepresentationChanger::Uint32OverflowOperatorFor+151692
22: 00007FFADB207034 BaseThreadInitThunk+20
23: 00007FFADBE02651 RtlUserThreadStart+33

The command I use is:

node --max-old-space-size=30 ./files_monitor.js

Why it doesn't work well even I do not use too many objects inside?

I happens after a long working time?

1 answer
5 points
Answered by:
Diana
720

Why do you want to run a JavaScript application in Node.js using only 30MB RAM?

By default Node.js uses 512MB.

Check if your code has some undeleted objects after a long time of working or change the memory limit to greater in node.

e.g.

node --max-old-space-size=1024 ./files_monitor.js

Where: 1024 means the limit will be 1024MB.

0 comments Add comment
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join