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

The image cache can lose track of a live image that it probably shouldn't lose track of #67069

Open
dnfield opened this issue Oct 1, 2020 · 1 comment
Labels
a: images Loading, displaying, rendering images c: performance Relates to speed or footprint issues (see "perf:" labels) framework flutter/packages/flutter repository. See also f: labels. P2 Important issues not at the top of the work list perf: memory Performance issues related to memory team-framework Owned by Framework team triaged-framework Triaged by Framework team

Comments

@dnfield
Copy link
Contributor

dnfield commented Oct 1, 2020

The following sequence would lead to this:

  • Put an image into the cache and hold a listener
  • Create a keepAlive handle on the completer once the image completes.
  • Remove the listener. At this point, the "last listener" callback will fire and remove the live image tracker.

In fact, the image should still be considered live because the completer/image are actually still available somewhere. Some potential solutions:

  1. Drop the whole listener callback, and just have the liveImage check if the completer is disposed or not when it's wanted. If it's disposed, drop the live listener from the cache. Need to make sure this doesn't accidentally retain the image, but I'm pretty sure it doesn't.
  2. Only call the last listener callback if the stream is getting disposed.

I started looking at doing this in #66688 but it was further complecting things and since this behavior existed already (e.g. add a listener, remove the last listener, add a listener again) I decided to leave it for a separate patch.

@dnfield dnfield added framework flutter/packages/flutter repository. See also f: labels. a: images Loading, displaying, rendering images perf: memory Performance issues related to memory labels Oct 1, 2020
@pedromassangocode pedromassangocode added passed first triage c: performance Relates to speed or footprint issues (see "perf:" labels) labels Oct 2, 2020
@kf6gpe kf6gpe added the P2 Important issues not at the top of the work list label Nov 9, 2020
@kf6gpe
Copy link
Contributor

kf6gpe commented Nov 9, 2020

Provisionally assigning a P4. @dnfield If you're currently working on this, let's bump the priority as you see fit.

@flutter-triage-bot flutter-triage-bot bot added team-framework Owned by Framework team triaged-framework Triaged by Framework team labels Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: images Loading, displaying, rendering images c: performance Relates to speed or footprint issues (see "perf:" labels) framework flutter/packages/flutter repository. See also f: labels. P2 Important issues not at the top of the work list perf: memory Performance issues related to memory team-framework Owned by Framework team triaged-framework Triaged by Framework team
Projects
None yet
Development

No branches or pull requests

4 participants