Hi there,
We have a massive problem with Syncfusion charts for flutter. Whenever the chart gets rebuilt (i.e. setState is called), the chart is leaking memory.
We have created a simple reproduction, that shows the problem. Every time the chart is rebuilt (which in our case can be a lot depending on user actions), the chart points seem to be doubled. here is a snippet (with full source code attached)
A screenshot for the memory usage (after a minute or two) can be seen here:
two)
Thanks in advance for the help!
Kind regards,
Luca from Gutta
Attachment: syncfusion_memory_leak_4903e7ea.zip
Dear Yuvaraj, this is not a fix, but simply a workaround. We also need to update the chart widget whenever the axes change for example, or whenever something else such as chart annotations changes.
What is causing the memory leak when rebuilding the chart widget? This should not be happening and definitely sounds like a serious bug to me.
We will have to rebuild the chart widget sometimes, and updateDatasource is not enough.
I hope you will investigate this further and try to find a fix.
Kind regards,
Luca
Hi Luca,
The reported issue regarding memory leak while rebuilding the application has been fixed, and it is rolled out. To avoid this issue please upgrade the chart package to the latest version below.
Version: https://pub.dev/packages/syncfusion_flutter_charts/versions/20.1.55
Regards,
Yuvaraj.
Hi Yuvaraj,
We have tried running our chart with syncfusion_flutter_chart version 20.1.56 and the problem is still persisting.
Hi Luca,
In previous releases, when the data source in chart widgets is updated using the setState() for every 100 milliseconds the application will get crash due to a memory leak, this was because of the series-related information. Now we have resolved the memory leak which was due to a series related things and now the app will not crash while updating the chart every 100ms. Since we are not aware in which scenario the memory leak occurs, we request to share a few details that may be helpful in further analysis in providing the solution sooner.
Thanks,
Yuvaraj.