# Dashboard memory leak

**URL:** https://discourse.nodered.org/t/dashboard-memory-leak/80157
**Category:** Dashboard
**Created:** [30 July 2023 03:47 UTC](https://discourse.nodered.org/t/dashboard-memory-leak/80157 "2023-07-30T03:47:15Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![daxliniere](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/daxliniere/32/42187_2.png) [@daxliniere](https://discourse.nodered.org/u/daxliniere)
#### Post date: [30 July 2023 03:47 UTC](https://discourse.nodered.org/t/dashboard-memory-leak/80157/1 "2023-07-30T03:47:15Z")

</div>

Chrome was showing 5.4Gb RAM used which seemed odd, since there were only 8 tabs open. When checking Chrome's task manager (SHIFT+ESC), I saw that my simple NR Dashboard tab was using 5.2Gb!  
I closed the tab and confirmed in Windows' task manager that NR dashboard was indeed the culprit.  
I've barely got anything going on, so what on earth could be causing such a memory leak?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/9/e92b6c8bfb7212f7f1b16be1c4e09cbb168e4a59.png)

There's a page 2, but it's just capturing a single frame from a webcam when the Take Photo button is pressed (not auto-refreshing).

---

<div class="post-metadata">

### Author: ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)
#### Post date: [30 July 2023 04:09 UTC](https://discourse.nodered.org/t/dashboard-memory-leak/80157/2 "2023-07-30T04:09:51Z")

</div>

How many points are displayed in your CPU Temp chart?  
6 points per minute for 48 hours would be more than 17000.

What difference does it make to memory usage if you use a rate limit node to send only 1 message per 10 minutes to the chart?

---

<div class="post-metadata">

### Author: ![daxliniere](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/daxliniere/32/42187_2.png) [@daxliniere](https://discourse.nodered.org/u/daxliniere)
#### Post date: [31 July 2023 02:13 UTC](https://discourse.nodered.org/t/dashboard-memory-leak/80157/3 "2023-07-31T02:13:39Z")

</div>

Yes, that's very likely the number of points, but surely it's only a few bytes, right??

---

<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: [31 July 2023 08:05 UTC](https://discourse.nodered.org/t/dashboard-memory-leak/80157/4 "2023-07-31T08:05:33Z")

</div>

What versions of node-red, nodejs and node-red-dashboard are you using?

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [31 July 2023 08:12 UTC](https://discourse.nodered.org/t/dashboard-memory-leak/80157/5 "2023-07-31T08:12:22Z")

</div>

> [@daxliniere](#):
>
> but surely it's only a few bytes, right??

It is not always about memory usage.

For example, from a view of a screenshot, the chart appears to be around 250pixels wide?

That is, 250 points can be cleanly shown on across that graph. So many of the points are likely hidden or obscured from view - wasteful off the bat.

But thats not all if it has 17000 data points to redraw when new data arrives.

And what about memory. Lets say each value is an 8 byte float, plus lets say 12 bytes to formulate the necessary JSON as the server transmits the data to the client side. 17000 \* (12 + 8), still only 340000b right. Now suppose the JS garbage collection or the JS code or the V8 engine or the NAPI stuff held onto that for some GC reason or bug. The ChartJS library that runs in Dashboard is several major versions behind current release (for legacy reasons)

Lastly, rendering 17000 data points is the real hit. The browser has to build 17000 HTML/SVG/canvas points to (not really) draw these in the space of 250px.

The point is, you should be mindful of what you are trying to achieve and how much sense it make.

Hope that jumbled rambling helps in some way 😃

---

<div class="post-metadata">

### Author: ![daxliniere](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/daxliniere/32/42187_2.png) [@daxliniere](https://discourse.nodered.org/u/daxliniere)
#### Post date: [31 July 2023 15:44 UTC](https://discourse.nodered.org/t/dashboard-memory-leak/80157/6 "2023-07-31T15:44:10Z")

</div>

NR: 2.1.6  
NodeJS: not sure  
Dashboard: 3.1.7 (updating now to 3.5.0, but see next reply)

---

<div class="post-metadata">

### Author: ![daxliniere](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/daxliniere/32/42187_2.png) [@daxliniere](https://discourse.nodered.org/u/daxliniere)
#### Post date: [31 July 2023 15:49 UTC](https://discourse.nodered.org/t/dashboard-memory-leak/80157/7 "2023-07-31T15:49:35Z")

</div>

Okay great to know and good solution.  
Since it feeds a meter as well, which I want to be fast response, I have duplicated the CPU temp check nodes and changed the update frequency to 415 secs rather than the original 10 secs.

I figure there's probably a node which can rate-limit based on time, but not sure which one. That would be a better way to do it to avoid node duplication.

Graph is 417px wide and spans 48 hours period.  
48hrs = 172800 secs  
172800/417 = 415 secs per graph point

---

<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: [31 July 2023 16:26 UTC](https://discourse.nodered.org/t/dashboard-memory-leak/80157/8 "2023-07-31T16:26:42Z")

</div>

> [@daxliniere](#):
>
> I figure there's probably a node which can rate-limit based on time

That is one of the modes of the built in Delay node.

---

<div class="post-metadata">

### Author: ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)
#### Post date: [31 July 2023 16:55 UTC](https://discourse.nodered.org/t/dashboard-memory-leak/80157/9 "2023-07-31T16:55:31Z")

</div>

It might be better to send it via [node-red-node-smooth (node) - Node-RED](https://flows.nodered.org/node/node-red-node-smooth) so the graph points are an average over 417 secs.

---

<div class="post-metadata">

### Author: ![daxliniere](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/daxliniere/32/42187_2.png) [@daxliniere](https://discourse.nodered.org/u/daxliniere)
#### Post date: [31 July 2023 17:08 UTC](https://discourse.nodered.org/t/dashboard-memory-leak/80157/10 "2023-07-31T17:08:27Z")

</div>

Ahh, that's a nice node! Thanks for the tip.

I guess that's smoothing every ~42 points.

Man, I love the people on this forum. Thanks everyone. ☺

---

<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: [30 August 2023 17:09 UTC](https://discourse.nodered.org/t/dashboard-memory-leak/80157/11 "2023-08-30T17:09:03Z")

</div>

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