# Inject node causing memory leak and node crash eventually

**URL:** <https://discourse.nodered.org/t/inject-node-causing-memory-leak-and-node-crash-eventually/52483>\
**Category:** General\
**Created:** [20 October 2021 18:22 UTC](https://discourse.nodered.org/t/inject-node-causing-memory-leak-and-node-crash-eventually/52483 "2021-10-20T18:22:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![netcyberg](https://avatars.discourse-cdn.com/v4/letter/n/94ad74/32.png) [@netcyberg](https://discourse.nodered.org/u/netcyberg)\
**Post date:** [20 October 2021 18:22 UTC](https://discourse.nodered.org/t/inject-node-causing-memory-leak-and-node-crash-eventually/52483/1 "2021-10-20T18:22:18Z")

</div>

Hello,

Why does the regular inject node with let's say 5sec intervals which is triggering the whole flow - result in memory leak (memory consumed by node-red process/docker container)?  
If I just disable inject node and add http-in node instead and make HTTP requests to it every 5 secs - everything works fine.

But the inject code eventually results in a node-red instance crash due to out of memory error.

How can I fix it? I need a trigger to run my flow by schedule/X seconds interval.  
What can I do about it?  
Thanks!!

---

<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:** [20 October 2021 19:13 UTC](https://discourse.nodered.org/t/inject-node-causing-memory-leak-and-node-crash-eventually/52483/2 "2021-10-20T19:13:39Z")

</div>

Not noticed any mem leaks in inject myself but I'm sure Nick will be interested if it is reproducable.

For workarounds, maybe try node-red-contrib-sun-position or cron+

---

<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:** [20 October 2021 19:26 UTC](https://discourse.nodered.org/t/inject-node-causing-memory-leak-and-node-crash-eventually/52483/3 "2021-10-20T19:26:14Z")

</div>

Do you get the same problem if you disconnect the wires connected to the output? So the messages it creates don't go anywhere?

---

<div class="post-metadata">

**Author:** ![netcyberg](https://avatars.discourse-cdn.com/v4/letter/n/94ad74/32.png) [@netcyberg](https://discourse.nodered.org/u/netcyberg)\
**Post date:** [22 October 2021 13:23 UTC](https://discourse.nodered.org/t/inject-node-causing-memory-leak-and-node-crash-eventually/52483/4 "2021-10-22T13:23:30Z")

</div>

Thank you, all for reply!  
And thanks Colin! I suppose this was the reason. I've disconnected all outputs (it had API output,flex-desh output and vuejs custom dashboard output connected).  
So I only left my custom vuejs dashboard connected as the single output, and it seemed to resolve the memory issue!

Wow, I'm so happy now 🙂

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/5/45828a5d7cf7f9e3ed6eecd952bd1860f3d3c352.png)

---

<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:** [21 December 2021 13:24 UTC](https://discourse.nodered.org/t/inject-node-causing-memory-leak-and-node-crash-eventually/52483/5 "2021-12-21T13:24:27Z")

</div>

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