# Encountering "JavaScript heap out of memory" and Other Issues with Node-RED

**URL:** <https://discourse.nodered.org/t/encountering-javascript-heap-out-of-memory-and-other-issues-with-node-red/86708>\
**Category:** General\
**Tags:** node-red-dashboard, windows-installer\
**Created:** [24 March 2024 06:08 UTC](https://discourse.nodered.org/t/encountering-javascript-heap-out-of-memory-and-other-issues-with-node-red/86708 "2024-03-24T06:08:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![KittisakC](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kittisakc/32/107485_2.png) [@KittisakC](https://discourse.nodered.org/u/KittisakC)\
**Post date:** [24 March 2024 06:08 UTC](https://discourse.nodered.org/t/encountering-javascript-heap-out-of-memory-and-other-issues-with-node-red/86708/1 "2024-03-24T06:08:34Z")

</div>

Hello Node-RED Community,

I've been encountering a "JavaScript heap out of memory" error in my Node-RED environment. This suggests that my flows might be processing too much data at once or possibly have a memory leak. I've tried increasing the memory available to Node-RED with the `--max-old-space-size` flag, but then I run into issues finding the correct module path.

In my `.node-red` directory, there are several backup files which I've been managing while trying to preserve my current configuration and possibly restore from a backup if needed.

Upon inspecting my `flows.json` file, I notice there's a mix of disabled and enabled flows. I'm unsure if this is causing any issues, or if there are flows that I should be activating instead.

Additionally, my Node-RED dashboard has a complex setup with custom themes which might be contributing to the configuration challenges.

I need help identifying the root cause of the memory error and resolving the module path issues. Furthermore, I would appreciate any guidance on managing my flows and ensuring the dashboard is configured correctly.

Any advice on these matters would be greatly appreciated.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/5/c53b0950bf0e53dd9a8e07337869de1623aa4f53.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/e/8e7cc225c0b72ccf34004577ad369f6618327c5c.png)

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [24 March 2024 13:27 UTC](https://discourse.nodered.org/t/encountering-javascript-heap-out-of-memory-and-other-issues-with-node-red/86708/2 "2024-03-24T13:27:54Z")

</div>

> [@KittisakC](#):
>
> --max-old-space-size

Please note that this DOES NOT do what most people think. It does not enable your Node.js app (Node-RED in this case) to use more memory directly. Rather, it steers how much memory is available to the "old" section of the heap. Whether this helps in a specific out of heap issue is complex.

Here are a couple of articles that may help:

> **[Tracing garbage collection | Node.js Learn](https://nodejs.org/learn/diagnostics/memory/using-gc-traces)**
>
> Node.js® is a free, open-source, cross-platform JavaScript runtime environment that lets developers create servers, web apps, command line tools and scripts.

> **[Node.js Memory Limits - What You Should Know | AppSignal Blog](https://blog.appsignal.com/2021/12/08/nodejs-memory-limits-what-you-should-know.html)**
>
> Let's dive into an introduction to memory limits and find out how to diagnose memory leaks in Node.js.

`Mark-Compact` is the last attempt by the Garbage Collector to create a large enough contiguous memory space to hold a JavaScript object that has been amended and made larger. The articles above explain what all the numbers mean.

While you _could_ increate max old space to close to the physical memory in your device, this may well cause other issues - notably SWAP activity which will generally kill the performance of the device and any services it is running.

The V8 engine that Node.js uses is actually very good a memory allocation these days, so assuming that you are using a current version of Node.js, it is rare that setting max old space will actually help.

The first thing I would recommend is removing the max old space setting completely and seeing if Node.js can work things out itself.

---

<div class="post-metadata">

**Author:** ![edje11](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edje11/32/572_2.png) [@edje11](https://discourse.nodered.org/u/edje11)\
**Post date:** [24 March 2024 16:19 UTC](https://discourse.nodered.org/t/encountering-javascript-heap-out-of-memory-and-other-issues-with-node-red/86708/3 "2024-03-24T16:19:24Z")

</div>

Looking at the first screen you are using charts.  
Try reducing the datapoints send to the charts and the number of charts used.

---

<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:** [22 June 2024 16:19 UTC](https://discourse.nodered.org/t/encountering-javascript-heap-out-of-memory-and-other-issues-with-node-red/86708/4 "2024-06-22T16:19:34Z")

</div>

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