Javascript heap out of memory

I am receiving this error in Galaxy with my app continously crashing. I have three 1GB size containers, however the memory usage per container never goes above 256MB?

Do I need to adjust the heap size manually in the settings file? I thought galaxy adjusted this for you based on the container size you deploy?

9qqsz
2025-05-21 20:41:46-05:00
9qqsz
2025-05-21 20:41:46-05:00<--- Last few GCs --->
9qqsz
2025-05-21 20:41:46-05:00
9qqsz
2025-05-21 20:41:46-05:00[8:0x6b57000] 329902 ms: Scavenge (reduce) (interleaved) 238.1 (246.7) -> 237.4 (247.0) MB, pooled: 0 MB, 100.35 / 0.00 ms (average mu = 0.230, current mu = 0.293) allocation failure;
9qqsz
2025-05-21 20:41:46-05:00[8:0x6b57000] 330503 ms: Mark-Compact (reduce) 237.5 (247.0) -> 234.8 (242.7) MB, pooled: 0 MB, 596.69 / 0.03 ms (+ 1421.7 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 2182 ms) (average mu = 0.317, current
9qqsz
2025-05-21 20:41:46-05:00
9qqsz
2025-05-21 20:41:46-05:00<--- JS stacktrace --->
9qqsz
2025-05-21 20:41:46-05:00
9qqsz
2025-05-21 20:41:46-05:00FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
9qqsz
2025-05-21 20:41:46-05:00----- Native stack trace -----
9qqsz
2025-05-21 20:41:46-05:00
9qqsz
2025-05-21 20:41:46-05:00 1: 0xe3811e node::OOMErrorHandler(char const*, v8::OOMDetails const&) [node]
9qqsz
2025-05-21 20:41:46-05:00 2: 0x125fb70 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
9qqsz
2025-05-21 20:41:46-05:00 3: 0x125fe47 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [node]
9qqsz
2025-05-21 20:41:46-05:00 4: 0x148d885 [node]
9qqsz
2025-05-21 20:41:46-05:00 5: 0x148d8b3 [node]
9qqsz
2025-05-21 20:41:46-05:00 6: 0x14a696a [node]
9qqsz
2025-05-21 20:41:46-05:00 7: 0x14a9b38 [node]
9qqsz
2025-05-21 20:41:46-05:00 8: 0x1ce63d1 [node]

This error is nasty to track down. Try playing with the container size, but this will most likely be an issue in some function that will cause the memory to fill up and crash. Try to figure out the timing on when this occur to see if you can pair this up with a specific function.

Hello @mvogt22

To fix this, you can manually increase the heap limit by setting the following environment variables in your Galaxy settings:

{
  "GALAXY_NODE_OPTIONS": "--max-old-space-size=800",
  "NODE_OPTIONS": "--max-old-space-size=800"
}

This sets the max heap size to 800 MB. You can adjust the value based on your app’s actual memory usage.

Also, if you’re on the Professional plan, I recommend checking the Galaxy - Monti APM. It can help identify methods or publications that are consuming excessive memory.

Best,