Is this the correct way to load images with Glide in Jetpack Compose? (Memory leak???)
- Dominant language
- Java
- Stars
- 35k
- Forks
- 6.2k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 8
Description
I loading images into a LazyColumn, and while the full-size image is loading, a much smaller thumbnail image shall and be replaced by the full-sized image.
Based on the documentation, my code looks like this:
@Composable
fun GlideImagePage(name: String, description: String, imageRes: Int, imageUrl: String, thumbnailUrl : String) {
val context = LocalContext.current
GlideImage(
model = imageUrl,
contentDescription = description,
modifier = Modifier
.padding(1.dp),
contentScale = ContentScale.FillWidth
){
Glide.with(context).load(imageUrl).thumbnail(
Glide.with(context).load(thumbnailUrl)
)
}
}
This code seems to be working, but i fear that there will be 3 requests created, one for the thumbnail image, one for the full-size image by the code in the inner braces, and before that, another request for the full-size image in the GlideImage Tag, Is this the case and if so, what happens to the full-size image request? Will it leak?
Can somebody enlighten me?
Thanks!
Contributor guide
Assessment
This issue has not been assessed yet.