# Allocation failed - JavaScript heap out of memory

**URL:** <https://discourse.nodered.org/t/allocation-failed-javascript-heap-out-of-memory/29618>\
**Category:** General\
**Created:** [6 July 2020 19:36 UTC](https://discourse.nodered.org/t/allocation-failed-javascript-heap-out-of-memory/29618 "2020-07-06T19:36:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JayCee](https://avatars.discourse-cdn.com/v4/letter/j/a5b964/32.png) [@JayCee](https://discourse.nodered.org/u/JayCee)\
**Post date:** [6 July 2020 19:36 UTC](https://discourse.nodered.org/t/allocation-failed-javascript-heap-out-of-memory/29618/1 "2020-07-06T19:36:12Z")

</div>

Hello Folks. I have to debug what is going on with my NR. Deployed in container, docker node-red.  
I was trying many things in parallel, so I don't know what is triggering crash of NR.  
How can I debug it deeper, which flow or node or function etc? In logs of docker I can find like below:

```auto
<--- Last few GCs --->
) [17:0x5557223fc880] 230223 ms: Mark-sweep 1400.7 (1452.5) -> 1401.0 (1440.0) MB, 10823.7 / 0.0 ms (+ 0.4 ms in 132 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 10987 ms) (average mu = 0.475, current mu = 0.016) all[17:0x5557223fc880] 239934 ms: Mark-sweep 1404.9 (1440.5) -> 1404.8 (1440.5) MB, 9541.7 / 0.0 ms (+ 156.1 ms in 38 steps since start of marking, biggest step 63.6 ms, walltime since start of marking 9706 ms) (average mu = 0.283, current mu = 0.007) all

<--- JS stacktrace --->
Cannot get stack trace in GC.
FATAL ERROR: MarkCompactCollector: semi-space copy, fallback in old gen Allocation failed - JavaScript heap out of memory

```

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [6 July 2020 21:33 UTC](https://discourse.nodered.org/t/allocation-failed-javascript-heap-out-of-memory/29618/2 "2020-07-06T21:33:24Z")

</div>

Based on that snippet, all we can say is that it is out of memory.. Maybe trying to process too much ? Or too large an object/image ? Or too fast ? Not freeing up memory fast enough ? Too many instances running for the machine ?

---

<div class="post-metadata">

**Author:** ![JayCee](https://avatars.discourse-cdn.com/v4/letter/j/a5b964/32.png) [@JayCee](https://discourse.nodered.org/u/JayCee)\
**Post date:** [7 July 2020 08:50 UTC](https://discourse.nodered.org/t/allocation-failed-javascript-heap-out-of-memory/29618/3 "2020-07-07T08:50:24Z")

</div>

You're right. But the question behind this is how to investigate what is causing the OOM. How I should debug?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [5 September 2020 08:50 UTC](https://discourse.nodered.org/t/allocation-failed-javascript-heap-out-of-memory/29618/4 "2020-09-05T08:50:26Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
