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

[Glide] Targets are never cleared #265

Closed
guillaume-tgl opened this issue Apr 25, 2023 · 2 comments
Closed

[Glide] Targets are never cleared #265

guillaume-tgl opened this issue Apr 25, 2023 · 2 comments
Assignees

Comments

@guillaume-tgl
Copy link

Please complete the following information:

  • Library Version v2.1.9
  • Affected Device(s) All

Describe the Bug:

I have a LazyColumn where an image is loaded with Glide in each item. And I've noticed that the memory cache is never used in that case because a new FlowCustomTarget is used for each new item and it's never cleared, preventing the resource from being added to the memory cache.
Also the target is not cleared when the flow is closed and there's this comment in the awaitClose block:

// intentionally do not clear using the Glide.clear for recycling internal bitmaps.

Expected Behavior:

I expect the resources to be cached in memory when they are not visible anymore so that they can be later retrieved.

@skydoves
Copy link
Owner

Hey @guillaume-tgl, this is a little bit more tricky than expected solution because Glide is not allowed to use a recycled bitmap. You can easily reproduce this issue by changing the comment with Glide.clear function with LazyColumn and LazyRow in the demo project.

Do you use a key parameter in LazyColumn for identifying each item?

@skydoves
Copy link
Owner

skydoves commented May 1, 2023

Hey @guillaume-tgl, I was thinking of this a bit, and I tweaked it a bit to clear the target out of the scope. It's available in the snapshot right now, and it will be included in the next release.

@skydoves skydoves closed this as completed May 1, 2023
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

No branches or pull requests

2 participants