# Memory Leaks in Node-RED

**URL:** https://discourse.nodered.org/t/memory-leaks-in-node-red/77981
**Category:** General
**Tags:** docker
**Created:** [27 April 2023 12:49 UTC](https://discourse.nodered.org/t/memory-leaks-in-node-red/77981 "2023-04-27T12:49:25Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![pekoto4349](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pekoto4349/32/78566_2.png) [@pekoto4349](https://discourse.nodered.org/u/pekoto4349)
#### Post date: [27 April 2023 12:49 UTC](https://discourse.nodered.org/t/memory-leaks-in-node-red/77981/1 "2023-04-27T12:49:25Z")

</div>

Hello everyone,

Im currently in the works of an experiment in which i encounter some issues with memory. The flow/code is memory leaking somewhere and the JS heap gets full. Is there any memory profiling tool that can be helpful in order to detect issues to memory ? Im using Node-RED Docker installation btw

Thanks in advance!

edit:

Here are the logs from Node-RED

 ![errorheap](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/8/08079cb577fc1942a1cf6daabd276548a1dcf44a.png)

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [27 April 2023 13:26 UTC](https://discourse.nodered.org/t/memory-leaks-in-node-red/77981/2 "2023-04-27T13:26:17Z")

</div>

Welcome to the forum @pekoto4349

Start by checking the stacktrace carefully. It may give you a clue to what is wrong.  
In future please if you want to post logs or the trace use copy/paste rather than screenshot. Thanks.

---

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [27 April 2023 15:22 UTC](https://discourse.nodered.org/t/memory-leaks-in-node-red/77981/3 "2023-04-27T15:22:25Z")

</div>

Hi @pekoto4349,  
If the memory is managed by the V8 engine, then you could e.g. take two heap dumps and compare them (see [here](https://github.com/bartbutenaers/node-red-contrib-heap-dump)). Then hopefully you can determine where the memory is allocated.  
Barr

---

<div class="post-metadata">

### Author: ![pekoto4349](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pekoto4349/32/78566_2.png) [@pekoto4349](https://discourse.nodered.org/u/pekoto4349)
#### Post date: [27 April 2023 17:01 UTC](https://discourse.nodered.org/t/memory-leaks-in-node-red/77981/4 "2023-04-27T17:01:31Z")

</div>

Hey @BartButenaers thanks for the tip! i will try using heap-dump and keep this thread posted if a solution comes up. Cheers!

---

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [27 April 2023 17:34 UTC](https://discourse.nodered.org/t/memory-leaks-in-node-red/77981/5 "2023-04-27T17:34:02Z")

</div>

@pekoto4349,  
You can also use the [node-red-contrib-inspector](https://github.com/bartbutenaers/node-red-contrib-inspector) node to put your NodeJs in debug mode, and then connect with Chrome developer tools to it.  
I have written some time ago a [tutorial](https://github.com/bartbutenaers/node-red-contrib-inspector/wiki/Use-CPU-profile-to-determine-what-takes-so-long) about doing something similar for cpu profiling. Of course you can do the same for memory profiling: go to the "Memory" tab instead, so you have the option to take different kind of heap snapshots. In your case record a heap profile inclusive stack traces might be useful to figure out where memory gets allocated..

---

<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: [26 June 2023 17:34 UTC](https://discourse.nodered.org/t/memory-leaks-in-node-red/77981/6 "2023-06-26T17:34:41Z")

</div>

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