Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing Memory leaks for Animations #7

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

knusperkrone
Copy link

@knusperkrone knusperkrone commented Feb 16, 2023

Thanks for this library. The current version holds 3 memory leaks tho.

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

  2. ChartLineDataItem::dispose
    You forgot to call dispose the touch events.

  3. Chart::didUpdateWidget
    When calling setState and start the animation you forget to dispose those CurvedAnimations, which then are registered on the AnimationHandler.
    Also, setting the _animation member to null is 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 the AnimationController.
    The leaking observer, then has to update for too many listeners resulting in poor performance.

Screenshot 2023-02-16 at 00 57 10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant