flutter icon indicating copy to clipboard operation
flutter copied to clipboard

Disposing the unavailable images evicted by ImageCache in time

Open 0xZOne opened this issue 2 years ago • 2 comments

Avoid additional keepalive to prevent disposing unavailable images that have already been evicted by ImageCache.

Fixes https://github.com/flutter/flutter/issues/125608

Pre-launch Checklist

  • [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • [x] I read the Tree Hygiene wiki page, which explains my responsibilities.
  • [x] I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • [x] I signed the CLA.
  • [x] I listed at least one issue that this PR fixes in the description above.
  • [x] I updated/added relevant documentation (doc comments with ///).
  • [x] I added new tests to check the change I am making, or this PR is test-exempt.
  • [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

0xZOne avatar Apr 27 '23 08:04 0xZOne

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

flutter-dashboard[bot] avatar Apr 27 '23 08:04 flutter-dashboard[bot]

This will not actually release memory.

In the case under test, the image render object is still in the tree holding onto the ui.Image.

Actually, the image has already been evicted by ImageCache and is no longer available. We should dispose of it in time to release memory as soon as possible.

0xZOne avatar May 06 '23 02:05 0xZOne

(Triage) @0xZOne @dnfield Are there still plans for this PR?

goderbauer avatar May 16 '23 22:05 goderbauer

(Triage) Since there was no follow-up I am going to close this one. Feel free to reopen if you find the time to work on this again. Thank you for your contribution!

goderbauer avatar Jun 13 '23 22:06 goderbauer