Reached heap limit Allocation failed - JavaScript heap out of memory


First time using service and I am testing with my nodejs backend.
My instance is in error with the following logs :

> tsc

<--- Last few GCs --->

[50:0x5e7cca0]    10761 ms: Mark-Compact 251.9 (258.7) -> 250.7 (258.7) MB, 283.77 / 0.00 ms  (average mu = 0.196, current mu = 0.074) allocation failure; scavenge might not succeed
[50:0x5e7cca0]    11075 ms: Mark-Compact 251.9 (258.7) -> 250.9 (259.2) MB, 300.61 / 0.00 ms  (average mu = 0.123, current mu = 0.042) allocation failure; scavenge might not succeed

<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
 1: 0xc9e850 node::Abort() [node]
 2: 0xb720ff  [node]
 3: 0xec1a70 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
 4: 0xec1d57 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
 5: 0x10d3dc5  [node]
 6: 0x10ebc48 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
 7: 0x10c1d61 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
 8: 0x10c2ef5 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [node]
 9: 0x109f536 v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [node]
10: 0x1090b6c v8::internal::FactoryBase<v8::internal::Factory>::AllocateRawArray(int, v8::internal::AllocationType) [node]
11: 0x1090cd4 v8::internal::FactoryBase<v8::internal::Factory>::NewFixedArrayWithFiller(v8::internal::Handle<v8::internal::Map>, int, v8::internal::Handle<v8::internal::Oddball>, v8::internal::AllocationType) [node]
12: 0x13bfcbd v8::internal::OrderedHashTable<v8::internal::OrderedHashMap, 2>::Allocate(v8::internal::Isolate*, int, v8::internal::AllocationType) [node]
13: 0x13bfd63 v8::internal::OrderedHashTable<v8::internal::OrderedHashMap, 2>::Rehash(v8::internal::Isolate*, v8::internal::Handle<v8::internal::OrderedHashMap>, int) [node]
14: 0x14f0973 v8::internal::Runtime_MapGrow(int, unsigned long*, v8::internal::Isolate*) [node]
15: 0x1934ef6  [node]
npm notice 
npm notice New minor version of npm available! 10.2.3 -> 10.5.0
npm notice Changelog: <>
npm notice Run `npm install -g npm@10.5.0` to update!
npm notice 
Instance terminated in nomad

Why is there a head out of memory ? It is working fine on another server.

Thanks in advance

Hi @Soramister,

How much memory does your service need? Did you try with a larger instance?

Thank you Yann, I have optimised my service to fit and keeping only what is necessary for now.