Memory leak with redraw
I have a dashboard I'm working on that has a line chart that updates periodically, with a variable number of legend items. Updating the number of legend items requires a redraw, so that's what I do.
However, letting something keep redrawing will cause chrome to crash due to an out of memory error after a few hours. As best as I can tell, this is entirely dependent on the redraw prop.
I attached a simple example which shows a line chart that updates its data every 3 seconds, toggling between one and two legend items. There's a toggle for redraw, to help demonstrate this phenomenon.
In chrome on my computer, without redraw on, the memory usage starts at 19 mb and stays at 19 mb throughout. With redraw on, memory usage grows at a constant rate of roughly 10 mb every 5 minutes. Most of the old chart is removed by the gc, but it's these tiny little blue dots of memory that stick around after the redraw.
Any thoughts on why redraw might be causing this memory leak? Or alternately, how I could vary the number of legend items without requiring a redraw?
Loving this library and all your hard work!
With redraw, it looks like the 'chart controller id' value keeps getting incremented, while it stays at 0 without redraw. Perhaps this is related?
Would appreciate if someone with the ability to would tag this as needs help or needs investigation.
The same is happening to me even using Redux.
Anyone have a solution to this? Having the same issue.
Can't reproduce on the latest react-chartjs-2 version.