Dashboard memory leak

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?

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).

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?

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

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

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 :smiley:

2 Likes

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

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

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

It might be better to send it via node-red-node-smooth (node) - Node-RED so the graph points are an average over 417 secs.

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. :smiling_face:

2 Likes

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