chipswithdrips
chipswithdrips

Reputation: 41

NodeJS - How do I increase the memory heap size?

I want to increase the memory heap size, but every time I try to do that it fails. I tried to install the package npm i increase-memory-limit but it doesn't do anything. I did run the command increase-memory-limit after installing it, but I still get the same crashes as before.

Currently I'm writing my NodeJS code in the PyCharm IDE on a Windows 10, if that helps.

Edit:

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: 00007FF686C0094F napi_wrap+124431
 2: 00007FF686BA2696 v8::base::CPU::has_sse+34502
 3: 00007FF686BA3356 v8::base::CPU::has_sse+37766
 4: 00007FF6873A6F4E v8::Isolate::ReportExternalAllocationLimitReached+94
 5: 00007FF68738EF91 v8::SharedArrayBuffer::Externalize+833
 6: 00007FF68725C85C v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1436
 7: 00007FF687258890 v8::internal::Heap::AddRetainedMap+2608
 8: 00007FF68727289E v8::internal::Factory::AllocateRawFixedArray+94
 9: 00007FF687279C34 v8::internal::Factory::NewFixedArrayWithFiller+52
10: 00007FF687279BF1 v8::internal::Factory::NewFixedArray+65
11: 00007FF68714A98F v8::internal::FeedbackNexus::ic_state+56767
12: 00007FF68715C6C5 v8::Message::GetIsolate+14101
13: 00007FF687168600 v8::Message::GetIsolate+63056
14: 00007FF68714438C v8::internal::FeedbackNexus::ic_state+30652
15: 00007FF68700E8AA v8::internal::OrderedHashMap::ValueAt+62122
16: 00007FF6877D2C6D v8::internal::SetupIsolateDelegate::SetupHeap+567949
17: 000002A6CAD8B865 

Upvotes: 3

Views: 12279

Answers (1)

Nenad Jovicic
Nenad Jovicic

Reputation: 185

When starting node server, check script that is running it should be something like node index.js or something like that.

Not so sure how it is in PyCharm when you run node But what can help you is option --max-old-space-size

So, I would suggest to try with command like

node --max-old-space-size=8192 index.js

Upvotes: 4

Related Questions