Node heap out of memory

I’m trying to deploy my NestJS API using the starter plan but I’m getting the following error:

<--- Last few GCs --->
[65:0x4ba18d0]    32973 ms: Mark-sweep (reduce) 254.6 (256.8) -> 253.8 (258.3) MB, 807.1 / 0.0 ms  (average mu = 0.386, current mu = 0.192) allocation failure scavenge might not succeed

<--- JS stacktrace --->
FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory
1: 0xa03530 node::Abort() [/usr/local/bin/node]
2: 0x94e471 node::FatalError(char const*, char const*) [/usr/local/bin/node]
3: 0xb7773e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
4: 0xb77ab7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
5: 0xd32345  [/usr/local/bin/node]

Looks like there is only 256MB available? I also tried adding --max_old_space_size=4096 on my node dist/main to start the API but didn’t help.

I was also thinking it’s because I was on the trial plan and added my credit card but it stayed the same.

Link to the API https://api-borh.onrender.com

Any help would be appreciated!

Hi @jeremybarbet, your Node process may only have 256MB of heap space available, but Render does make 512MB of RAM available to starter services overall. I’m not sure whether this makes a difference, but I’ve normally seen that option as --max-old-space-size rather than --max_old_space_size. You might also try limiting memory usage, or temporarily upgrading to a larger plan. You can switch back to the starter plan at any time and we only charge you for the time you spent on the higher plan, with billing prorated by the second.

Ensure all of your builds and compilations are performed only in build command, because build minutes are meant to be runned on powerful machine with a lot of ram, while deployment is hosted on low-end vm.

1 Like

Hi there,

Please note that larger build plans were not available when this post was first created. I’m going to close this thread to prevent further updates.

Regards,

Keith
Render Support, UTC+10 :australia: