3

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 
chipswithdrips
  • 41
  • 1
  • 1
  • 7
  • 1
    Please explain how it fails and the steps you are performing to provoke the issue. You might be able to solve your problem using the max-old-space-size option for node. You might take a look at https://medium.com/@vuongtran/how-to-solve-process-out-of-memory-in-node-js-5f0de8f8464c – abondoa Nov 15 '19 at 00:24
  • I've developed a script for a small company I'm working with and after handing out the exe file (made with npm nexe) to the research team, they've told me that the script can't run for too long because they get an error related to the question I've made. I've tested the script myself, but not for more than 10 or 20 minutes and I didn't know about this error and now I'm trying to figure out what to be done. Hopefully I've made myself more clear regarding my issue. – chipswithdrips Nov 15 '19 at 00:32
  • "As of Node.js v8.0 shipped August 2017, you can now use the NODE_OPTIONS environment variable to set the max_old_space_size globally" [**Check this post out:** https://stackoverflow.com/a/48895989/4200039](https://stackoverflow.com/a/48895989/4200039) – Tim Nov 15 '19 at 01:05
  • If you copy past the error into the question someone may be able to give you more specific help. – Tim Nov 15 '19 at 01:07
  • Sorry for the late reply. Anyway, I've just updated the post with the error. – chipswithdrips Nov 16 '19 at 00:14
  • @chipswithdrips I believe you might need to alter your way of using nexe. I am not too familiar with it myself, but you might need to add the --enableNodeCli flag (and the --build flag) during your build and then add e.g. --max_old_space_size=5000 when running the actual exe file. Take a look at the following for inspiration: https://github.com/nexe/nexe/issues/383 – abondoa Nov 17 '19 at 22:20

1 Answers1

4

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

Nenad Jovicic
  • 188
  • 1
  • 7