mrx-flutter-charts
mrx-flutter-charts copied to clipboard
Fixing Memory leaks for Animations
Thanks for this library. The current version holds 3 memory leaks tho.
-
Chart::dispose Neither the current widget layers, nor the old layers are disposed by the regular lifecycle events. This may not be a problem, as all memory is most likely is to be freed, when the AnimationController dispose is called- but you never know.
-
ChartLineDataItem::dispose You forgot to call dispose the touch events.
-
Chart::didUpdateWidget When calling
setStateand start the animation you forget to dispose thoseCurvedAnimations, which then are registered on the AnimationHandler. Also, setting the_animationmember tonullis basically a no-op, as need to dispose the animation. I have included a screenshot where you can easily see the insane big amount of closures held by theAnimationController. The leaking observer, then has to update for too many listeners resulting in poor performance.
