Node: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

Created on 27 Dec 2017  路  2Comments  路  Source: nodejs/node

I'm using node v8.4.0 on ubuntu 17.04 and I'm trying to parse data from external data from an external api, when I run the program I got this error:

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node::Abort() [node]
 2: 0x13740dc [node]
 3: v8::Utils::ReportOOMFailure(char const*, bool) [node]
 4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [node]
 5: v8::internal::Factory::NewByteArray(int, v8::internal::PretenureFlag) [node]
 6: v8::internal::Factory::NewCode(v8::internal::CodeDesc const&, unsigned int, v8::internal::Handle<v8::internal::Object>, bool, bool, int, bool) [node]
 7: v8::internal::CodeGenerator::MakeCodeEpilogue(v8::internal::MacroAssembler*, v8::internal::EhFrameWriter*, v8::internal::CompilationInfo*, v8::internal::Handle<v8::internal::Object>) [node]
 8: v8::internal::compiler::CodeGenerator::FinalizeCode() [node]
 9: v8::internal::compiler::PipelineImpl::FinalizeCode() [node]
10: v8::internal::compiler::PipelineCompilationJob::FinalizeJobImpl() [node]
11: v8::internal::CompilationJob::FinalizeJob() [node]
12: v8::internal::Compiler::FinalizeCompilationJob(v8::internal::CompilationJob*) [node]
13: v8::internal::OptimizingCompileDispatcher::InstallOptimizedFunctions() [node]
14: v8::internal::StackGuard::HandleInterrupts() [node]
15: v8::internal::Runtime_StackGuard(int, v8::internal::Object**, v8::internal::Isolate*) [node]
16: 0x30ea1f8840dd
Aborted (core dumped)

How can I fix that?

question wrong repo

Most helpful comment

Your Javascript heap is running out of memory. By default, Node (and V8) only allows 1Gb of memory allocated for the heap.

You can increase the size of the heap with --max-old-space-size=N, where N is the number of Mb available for the heap. However, this is not a scalable solution, you'll probably need to diagnose what's consuming that much memory and refactor something in the code (maybe parsing the data in chunks if possible).

All 2 comments

Your Javascript heap is running out of memory. By default, Node (and V8) only allows 1Gb of memory allocated for the heap.

You can increase the size of the heap with --max-old-space-size=N, where N is the number of Mb available for the heap. However, this is not a scalable solution, you'll probably need to diagnose what's consuming that much memory and refactor something in the code (maybe parsing the data in chunks if possible).

Can you post questions to the help repo?

Was this page helpful?
0 / 5 - 0 ratings