Heap overflow during Nativescript application build on MacOS - node.js

World
I'm developing mobile application using Nativescript, most latest version.
Android build is OK.
But iOS is pain in the back for me.
I'm constantly receiving heap overflow. Tried to set more heap memory for node...
Mac Mini with 8GB RAM.
Just upgraded do 16GB - no change.
nrtc63-99:zplapp nrtc63$ export | grep NODE
declare -x NODE_OPTIONS="--max_old_space_size=12192"
Tried also other values starting including 8192 and dashes --max-old-space-size.
Build log...
<--- Last few GCs --->
[1535:0x102d4e000] 314170 ms: Scavenge 4078.7 (4103.3) -> 4078.0 (4103.3) MB, 11.8 / 0.0 ms (average mu = 0.356, current mu = 0.326) allocation failure
[1535:0x102d4e000] 314179 ms: Scavenge 4078.9 (4103.3) -> 4078.2 (4103.5) MB, 9.0 / 0.0 ms (average mu = 0.356, current mu = 0.326) allocation failure
[1535:0x102d4e000] 316720 ms: Mark-sweep 4080.1 (4104.7) -> 4077.1 (4104.3) MB, 2537.7 / 0.0 ms (average mu = 0.318, current mu = 0.280) allocation failure scavenge might not succeed
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 0x1009ce0f9]
Security context: 0x02b2663408d1 <JSObject>
1: SourceMapConsumer_allGeneratedPositionsFor [0x2b20af167f9] [/Users/nrtc63/WebstormProjects/zplapp/node_modules/#babel/core/node_modules/source-map/lib/source-map-consumer.js:~178] [pc=0xe56ee1564df](this=0x02b2a7e50051 <BasicSourceMapConsumer map = 0x2b2c76e1b39>,0x02b2b5295e01 <Object map = 0x2b2c76e1099>)
2: /* anonymous */(aka /* anonymous */) [0x...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0x1011bdf85 node::Abort() (.cold.1) [/usr/local/bin/node]
2: 0x10009d119 node::Abort() [/usr/local/bin/node]
3: 0x10009d27f node::OnFatalError(char const*, char const*) [/usr/local/bin/node]
4: 0x1001de7b7 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
5: 0x1001de757 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
6: 0x100364225 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/usr/local/bin/node]
7: 0x100365a7a v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [/usr/local/bin/node]
8: 0x1003624fe v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/bin/node]
9: 0x1003602b0 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
10: 0x10036c0da v8::internal::Heap::AllocateRawWithLightRetry(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
11: 0x10036c161 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
12: 0x10033a5ea v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/local/bin/node]
13: 0x100689068 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
14: 0x1009ce0f9 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/usr/local/bin/node]
15: 0xe56ee1564df
16: 0x100953aa4 Builtins_InterpreterEntryTrampoline [/usr/local/bin/node]
17: 0x1009e01ec Builtins_ArrayForEach [/usr/local/bin/node]
Executing webpack failed with exit code null.
Memory utilisation for node process grows up to 4.3GB and then heap-overflow is raised.

Related

Replit console error <--- Last few GCs ---> and <--- JS stacktrace --->

So I was using my bot but since it didn't respond, I decided to check why it was offline. I opened up my code and I found this error in the console. I just wanna know what it means. Here :
<--- Last few GCs --->
[880:0x4b70e20] 26014144 ms: Mark-sweep 234.2 (257.5) -> 234.2 (257.8) MB, 2824.5 / 0.0 ms (average mu = 0.148, current mu = 0.008) allocation failure scavenge might not succeed
[880:0x4b70e20] 26017038 ms: Mark-sweep 234.6 (257.8) -> 234.5 (257.8) MB, 2888.0 / 0.0 ms (average mu = 0.081, current mu = 0.002) allocation failure scavenge might not succeed
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x1f02f9e808d1 <JSObject>
0: builtin exit frame: parse(this=0x1f02f9e9ee79 <Object map = 0x1cdd4fa03639>,0x15196d9c0119 <Very long string[8081560]>,0x1f02f9e9ee79 <Object map = 0x1cdd4fa03639>)
1: onMessage [0x118b705220e9] [/home/runner/New-Neptune/node_modules/discord.js/src/client/websocket/WebSocketShard.js:~278] [pc=0x2bb58926f89e](this=0x3f8662a33761 <EventEmitter map = 0x2d550d1ce3a9>,0x1166c1f7f291 <Even...
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0xa1a640 node::Abort() [node]
2: 0xa1aa4c node::OnFatalError(char const*, char const*) [node]
3: 0xb9a68e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
4: 0xb9aa09 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
5: 0xd57c85 [node]
6: 0xd58316 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [node]
7: 0xd64bd5 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node]
8: 0xd65a85 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
9: 0xd6853c v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
10: 0xd363dc v8::internal::Factory::NewRawOneByteString(int, v8::internal::AllocationType) [node]
11: 0xe4561b v8::internal::JsonParser<unsigned short>::MakeString(v8::internal::JsonString const&, v8::internal::Handle<v8::internal::String>) [node]
12: 0xe47e9e v8::internal::JsonParser<unsigned short>::ParseJsonValue() [node]
13: 0xe486af v8::internal::JsonParser<unsigned short>::ParseJson() [node]
14: 0xc4bc05 v8::internal::Builtin_JsonParse(int, unsigned long*, v8::internal::Isolate*) [node]
15: 0x140df99 [node]

JavaScript heap out of memory
It ran out of memory.
Without seeing your code, it's impossible to say why in particular, but seeing Builtin_JsonParse in the stack means it was probably parsing a big JSON response from somewhere.
In my case, I was pre autopopulating my document with fields that reference see here its own model...When I tried to hit my API with new data it was working fine like in my case when I was logging in with new signup data it was working fine but with old login data, it was running an infinite loop due to autopopulate which further caused heap out of memory issue..I just realized when I turned on mongoose debugger....After removing those autopopulates my application is working fine
removing autopopulate
Then I removed these autopopulate statements from my code and now it's working fine

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

I got this problem in my project. I have already searched all solutions available online but can't find anything that can solve my issue..
<--- Last few GCs --->
[1884:0x105805200] 415338 ms: Mark-sweep 2010.8 (2087.2) -> 1994.5 (2087.5) MB, 5902.5 / 0.1 ms (average mu = 0.149, current mu = 0.059) allocation failure scavenge might not succeed
[1884:0x105805200] 425392 ms: Mark-sweep 2010.9 (2087.5) -> 1994.6 (2087.2) MB, 9442.2 / 0.1 ms (average mu = 0.101, current mu = 0.061) allocation failure scavenge might not succeed
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0x10135cf15 node::Abort() (.cold.1) [/usr/local/bin/node]
2: 0x1000bcbe9 node::Abort() [/usr/local/bin/node]
3: 0x1000bcd4f node::OnFatalError(char const*, char const*) [/usr/local/bin/node]
4: 0x10022cbc7 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
5: 0x10022cb63 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
6: 0x1003e7205 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/usr/local/bin/node]
7: 0x1003e8dc3 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [/usr/local/bin/node]
8: 0x1003e4e2f v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/bin/node]
9: 0x1003e27bd v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/bin/node]
10: 0x1003f041a v8::internal::Heap::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
11: 0x1003f04a1 v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/bin/node]
12: 0x1003bd3cd v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/local/bin/node]
13: 0x100742def v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
14: 0x100abf679 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/usr/local/bin/node]
15: 0x3c7a98d52181
16: 0x3c7a9916806c
Abort trap: 6
how can I fixed this?
There are two ways you can increase the memory allocated to node:
In your terminal, export NODE_OPTIONS="--max-old-space-size=4096". As explained here, be mindful of how much memory you allocate.
You can also specify this as a setting in your app level build.gradle file:
project.ext.react = [
nodeExecutableAndArgs: ["node", "--max-old-space-size=4096"]
]

AWS EC2 Nodejs | FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory in vuejs project

I am running a nodejs app on AWS ec2 instance(t2.small). After it works around one week. Below out of memory error comes. Searched for same issues, found there is a workaround to increase "--max-old-space-size" option. However, my question is
if i set --max-old-space-size = 4096(4gb). Do i need to update the aws instance to get more memory(as small type only have 2 gb memory)
This max-old-space-size setting,finally will it also hit memory limitation? At the beginning, the app is working fine, but after period of time, app is crushed. If that, how to slove this issue effectively?
The full error message as below:
<--- Last few GCs --->
[30600:0x5007800] 429029005 ms: Mark-sweep 977.8 (1007.7) -> 970.6 (1008.9) MB, 2379.3 / 0.5 ms (average mu = 0.220, current mu = 0.190) allocation failure scavenge might n
ot succeed
[30600:0x5007800] 429031937 ms: Mark-sweep 979.0 (1008.9) -> 971.8 (1010.4) MB, 2396.6 / 0.4 ms (average mu = 0.202, current mu = 0.183) allocation failure scavenge might n
ot succeed
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 0xa02ec0 node::Abort() [node]
2: 0x94e471 node::FatalError(char const*, char const*) [node]
3: 0xb765de v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
4: 0xb76957 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
5: 0xd311f5 [node]
6: 0xd31d7f [node]
7: 0xd3fe0b v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
8: 0xd439cc v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [no
de]
9: 0xd120ab v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [node]
10: 0x105802f v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [node]
11: 0x13fdfd9 [node]
./backend.sh: line 6: 30600 Aborted node server.js
Thanks for all your help!

Large post request makes Nodejs server run out of heap memory

I am running a NodeJS server and when it takes a large post request(>100mb), it fails due to heap out of memory.
I have tried setting --max-old-space-size=8000, but it didn't work at all even though I set it properly and checked that it is set to 8GB.
<--- Last few GCs --->
GC[20429:0x3851890] 12498 ms: Mark-sweep 400.5 (420.8) -> 316.5 (336.7) MB, 7.3 / 0.0 ms (+ 5.3 ms in 1 steps since start of marking, biggest step 5.3 ms, walltime since start of marking 1796 ms) (average mu = 0.991, current mu = 0.994) allocation failu[20429:0x3851890] 15081 ms: Mark-sweep 700.5 (720.8) -> 412.5 (432.7) MB, 114.6 / 0.0 ms (+ 0.0 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 2583 ms) (average mu = 0.967, current mu = 0.956) allocation fai
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 0x3ac05b24fc5d]
Security context: 0x3661c71546f1 <JSObject>
1: slice [0x3661c71409e9](this=0x0287971abf39 <Uint8Array map = 0x382c0352a4d1>,0)
2: md5 [0x14615e91adb1] [/home/minjae/Dev/mednick_minjae/mednick_api_minjae/node_modules/md5/md5.js:16] [bytecode=0x16b93054ad39 offset=106](this=0x1dac4a782371 <JSGlobal Object>,0x0287971abf39 <Uint8Array map = 0x382c0352a4d1>,0x2eaf18e825b1 <undefined>)
3: /* ano...
FATAL ERROR: invalid table size Allocation failed - JavaScript heap out of memory
1: 0x95bd00 node::Abort() [/usr/bin/node]
2: 0x95cc46 node::OnFatalError(char const*, char const*) [/usr/bin/node]
3: 0xb3dbde v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/bin/node]
4: 0xb3de14 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/bin/node]
5: 0xf3ce52 [/usr/bin/node]
6: 0x105f567 v8::internal::HashTable<v8::internal::NumberDictionary, v8::internal::NumberDictionaryShape>::New(v8::internal::Isolate*, int, v8::internal::PretenureFlag, v8::internal::MinimumCapacity) [/usr/bin/node]
7: 0x105fdcd v8::internal::HashTable<v8::internal::NumberDictionary, v8::internal::NumberDictionaryShape>::EnsureCapacity(v8::internal::Isolate*, v8::internal::Handle<v8::internal::NumberDictionary>, int, v8::internal::PretenureFlag) [/usr/bin/node]
8: 0x10607fb v8::internal::Dictionary<v8::internal::NumberDictionary, v8::internal::NumberDictionaryShape>::Add(v8::internal::Isolate*, v8::internal::Handle<v8::internal::NumberDictionary>, unsigned int, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyDetails, int*) [/usr/bin/node]
9: 0xec2cee [/usr/bin/node]
10: 0x105a3d4 v8::internal::JSObject::AddDataElement(v8::internal::Handle<v8::internal::JSObject>, unsigned int, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes) [/usr/bin/node]
11: 0x10738bb v8::internal::Object::AddDataProperty(v8::internal::LookupIterator*, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, v8::internal::ShouldThrow, v8::internal::Object::StoreFromKeyed) [/usr/bin/node]
12: 0x107aec0 v8::internal::JSObject::DefineOwnPropertyIgnoreAttributes(v8::internal::LookupIterator*, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, v8::internal::ShouldThrow, v8::internal::JSObject::AccessorInfoHandling) [/usr/bin/node]
13: 0x107e3f5 v8::internal::JSObject::CreateDataProperty(v8::internal::LookupIterator*, v8::internal::Handle<v8::internal::Object>, v8::internal::ShouldThrow) [/usr/bin/node]
14: 0x108ff18 v8::internal::JSReceiver::CreateDataProperty(v8::internal::LookupIterator*, v8::internal::Handle<v8::internal::Object>, v8::internal::ShouldThrow) [/usr/bin/node]
15: 0x11f6770 v8::internal::Runtime_CreateDataProperty(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/bin/node]
16: 0x3ac05b24fc5d
Aborted
I firstly thought that there is a code causing error, taking much heap space. However, it prints error when it doesn't even get to my very first code. It seems to break when it is receiving the post request.
You can use streams to send request data in chunks (smaller parts). A good example is here. The example is for a file. However, if it is non-file data (e.g. text, JSON, XML), you can write it to a temp file, send that file to your server in chunks and have the server read the file, to retrieve data you sent, once all chunks are received.

Do I just need an EC2 instance with more memory or does this error suggest issues in my code?

The short answer is "of course there are problems in my code," but for the time being, I'm wondering if the error messages I'm receiving can help me fix a specific problem. My app is running on sails, using Node v8.1.2 running on an EC2 instance modified from this Bitnami image. The instance type is t2.small (2GB memory), which I should probably upgrade, in any case.
Is this an error message I should review closely and use to find bugs? Or should I just switch to a larger instance and hope for the best? Thanks in advance.
bitnami#ip-172-31-17-108:~$ sudo forever stopall
^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A^[[A
<--- Last few GCs --->
[5547:0x3ec5a50] 111819 ms: Scavenge 6.7 (10.0) -> 6.3 (10.5) MB, 153.7 / 2.2 ms allocation failure
[5547:0x3ec5a50] 130817 ms: Scavenge 7.3 (10.5) -> 6.8 (11.0) MB, 207.3 / 9.4 ms allocation failure
[5547:0x3ec5a50] 164550 ms: Scavenge 7.8 (11.0) -> 7.3 (11.5) MB, 155.3 / 8.0 ms allocation failure
[5547:0x3ec5a50] 203571 ms: Scavenge 8.2 (11.5) -> 7.6 (11.5) MB, 317.2 / 42.5 ms allocation failure
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x9d40a2a9891 <JS Object>
1: patch [/opt/bitnami/nodejs/lib/node_modules/forever/node_modules/graceful-fs/polyfills.js:64] [pc=0x426fa5d7cb1](this=0x38dbb211729 <JS Global Object>,fs=0xfd51435b869 <an Object with deprecated map 0x4376127ec19>)
2: patch [/opt/bitnami/nodejs/lib/node_modules/forever/node_modules/graceful-fs/graceful-fs.js:58] [pc=0x426fa5d6791](this=0x38dbb211729 <JS Global Object>,fs=0xfd51435b869...
FATAL ERROR: Committing semi space failed. Allocation failed - process out of memory
1: node::Abort() [/opt/bitnami/nodejs/bin/.node.bin]
2: 0x13647ec [/opt/bitnami/nodejs/bin/.node.bin]
3: v8::Utils::ReportOOMFailure(char const*, bool) [/opt/bitnami/nodejs/bin/.node.bin]
4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/opt/bitnami/nodejs/bin/.node.bin]
5: v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/opt/bitnami/nodejs/bin/.node.bin]
6: v8::internal::Heap::CollectGarbage(v8::internal::GarbageCollector, v8::internal::GarbageCollectionReason, char const*, v8::GCCallbackFlags) [/opt/bitnami/nodejs/bin/.node.bin]
7: v8::internal::Factory::NewMap(v8::internal::InstanceType, int, v8::internal::ElementsKind) [/opt/bitnami/nodejs/bin/.node.bin]
8: v8::internal::Map::RawCopy(v8::internal::Handle<v8::internal::Map>, int) [/opt/bitnami/nodejs/bin/.node.bin]
9: v8::internal::Map::CopyDropDescriptors(v8::internal::Handle<v8::internal::Map>) [/opt/bitnami/nodejs/bin/.node.bin]
10: v8::internal::Map::AddMissingTransitions(v8::internal::Handle<v8::internal::Map>, v8::internal::Handle<v8::internal::DescriptorArray>, v8::internal::Handle<v8::internal::LayoutDescriptor>) [/opt/bitnami/nodejs/bin/.node.bin]
11: v8::internal::MapUpdater::ConstructNewMap() [/opt/bitnami/nodejs/bin/.node.bin]
12: v8::internal::MapUpdater::ReconfigureToDataField(int, v8::internal::PropertyAttributes, v8::internal::PropertyConstness, v8::internal::Representation, v8::internal::Handle<v8::internal::FieldType>) [/opt/bitnami/nodejs/bin/.node.bin]
13: 0xffc3a0 [/opt/bitnami/nodejs/bin/.node.bin]
14: v8::internal::Map::PrepareForDataProperty(v8::internal::Handle<v8::internal::Map>, int, v8::internal::PropertyConstness, v8::internal::Handle<v8::internal::Object>) [/opt/bitnami/nodejs/bin/.node.bin]
15: v8::internal::LookupIterator::PrepareForDataProperty(v8::internal::Handle<v8::internal::Object>) [/opt/bitnami/nodejs/bin/.node.bin]
16: v8::internal::Object::SetDataProperty(v8::internal::LookupIterator*, v8::internal::Handle<v8::internal::Object>) [/opt/bitnami/nodejs/bin/.node.bin]
17: v8::internal::Object::SetPropertyInternal(v8::internal::LookupIterator*, v8::internal::Handle<v8::internal::Object>, v8::internal::LanguageMode, v8::internal::Object::StoreFromKeyed, bool*) [/opt/bitnami/nodejs/bin/.node.bin]
18: v8::internal::Object::SetProperty(v8::internal::LookupIterator*, v8::internal::Handle<v8::internal::Object>, v8::internal::LanguageMode, v8::internal::Object::StoreFromKeyed) [/opt/bitnami/nodejs/bin/.node.bin]
19: v8::internal::StoreIC::Store(v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Name>, v8::internal::Handle<v8::internal::Object>, v8::internal::Object::StoreFromKeyed) [/opt/bitnami/nodejs/bin/.node.bin]
20: v8::internal::Runtime_StoreIC_Miss(int, v8::internal::Object**, v8::internal::Isolate*) [/opt/bitnami/nodejs/bin/.node.bin]
21: 0x426fa38437d
bitnami#ip-172-31-17-108:~$ <--- JS stacktrace --->^C
bitnami#ip-172-31-17-108:~$ cd my-sails-api/
bitnami#ip-172-31-17-108:~/my-sails-api$ sudo sails lift
<--- Last few GCs --->
[5562:0x2739a40] 79195 ms: Scavenge 5.7 (10.1) -> 5.6 (9.6) MB, 304.7 / 8.1 ms allocation failure
[5562:0x2739a40] 98188 ms: Scavenge 6.6 (9.6) -> 5.9 (10.1) MB, 252.5 / 24.5 ms allocation failure
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x25f39c629891 <JS Object>
2: constructor(aka Duplex) [_stream_duplex.js:48] [pc=0x178f7677eb54](this=0x20617eab9791 <a WriteStream with map 0x1d0c9952641>,options=0x20617eab98e9 <an Object with map 0x1d0c9952329>)
3: constructor(aka Socket) [net.js:197] [pc=0x178f7677de42](this=0x20617eab9791 <a WriteStream with map 0x1d0c9952641>,options=0x20617eab98e9 <an Object with map 0x1d0c9952329>)
4: new constructor(...
FATAL ERROR: Committing semi space failed. Allocation failed - process out of memory
1: node::Abort() [/opt/bitnami/nodejs/bin/.node.bin]
2: 0x13647ec [/opt/bitnami/nodejs/bin/.node.bin]
3: v8::Utils::ReportOOMFailure(char const*, bool) [/opt/bitnami/nodejs/bin/.node.bin]
4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/opt/bitnami/nodejs/bin/.node.bin]
5: v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/opt/bitnami/nodejs/bin/.node.bin]
6: v8::internal::Heap::CollectGarbage(v8::internal::GarbageCollector, v8::internal::GarbageCollectionReason, char const*, v8::GCCallbackFlags) [/opt/bitnami/nodejs/bin/.node.bin]
7: v8::internal::Factory::NewCode(v8::internal::CodeDesc const&, unsigned int, v8::internal::Handle<v8::internal::Object>, bool, bool, int, bool) [/opt/bitnami/nodejs/bin/.node.bin]
8: v8::internal::CodeGenerator::MakeCodeEpilogue(v8::internal::MacroAssembler*, v8::internal::EhFrameWriter*, v8::internal::CompilationInfo*, v8::internal::Handle<v8::internal::Object>) [/opt/bitnami/nodejs/bin/.node.bin]
9: v8::internal::FullCodeGenerator::MakeCode(v8::internal::CompilationInfo*, unsigned long) [/opt/bitnami/nodejs/bin/.node.bin]
10: v8::internal::FullCodegenCompilationJob::ExecuteJobImpl() [/opt/bitnami/nodejs/bin/.node.bin]
11: v8::internal::CompilationJob::ExecuteJob() [/opt/bitnami/nodejs/bin/.node.bin]
12: 0xd97d90 [/opt/bitnami/nodejs/bin/.node.bin]
13: 0xd98b28 [/opt/bitnami/nodejs/bin/.node.bin]
14: 0xd98d8f [/opt/bitnami/nodejs/bin/.node.bin]
15: 0xd9ce59 [/opt/bitnami/nodejs/bin/.node.bin]
16: v8::internal::Compiler::Compile(v8::internal::Handle<v8::internal::JSFunction>, v8::internal::Compiler::ClearExceptionFlag) [/opt/bitnami/nodejs/bin/.node.bin]
17: v8::internal::Runtime_CompileLazy(int, v8::internal::Object**, v8::internal::Isolate*) [/opt/bitnami/nodejs/bin/.node.bin]
18: 0x178f7658437d
bitnami#ip-172-31-17-108:~/my-sails-api$
bitnami#ip-172-31-17-108:~/my-sails-api$ sudo sails lift
-bash: fork: Cannot allocate memory
bitnami#ip-172-31-17-108:~/my-sails-api$
By default node.js will not allow you to allocate more than 1.7GB in one process so no - there's no point in upgrading unless you're sure you can't do anything in your code to consume less memory (for example use streams).
If you have no other choice you can try to increase the size of allowed memory - but keep in mind that it will probably impact the speed of your program - by setting the following option:
--max_old_space_size <size in mb>
Run node --v8-options for more information.

Resources