coil-kt/coil

IOS App crashes with `didReceiveMemoryWarning`

开放

#2,765 创建于 2024年12月28日

 (7 条评论) (0 个反应) (0 位负责人)Kotlin (757 个派生)batch import
help wanted

仓库指标

星标
 (11,779 个星标)
PR 合并指标
 (平均合并 20小时 14分钟) (30 天内合并 28 个 PR)

描述

Describe the bug iOS App Crashes when a LazyColumn is scrolled fast. I have a lazy column with around 500+ items in it. If i scroll the lazy column fast or flick too much, iOS App crashes with didReceiveMemoryWarning error logged in XCode. Android app on the other hand works perfectly fine.

To Reproduce

@Composable
fun MyImage(
    url: String,
    placeholder: Painter? = null,
    error: Painter? = placeholder,
    contentDescription: String,
    modifier: Modifier = Modifier,
    contentScale: ContentScale = ContentScale.Fit
) {
    setSingletonImageLoaderFactory { context ->
        ImageLoader.Builder(context)
            .crossfade(true)
            .coroutineContext(Dispatchers.Default)
            .build()
    }
    AsyncImage(
        model = url,
        contentDescription = contentDescription,
        modifier = modifier,
        contentScale = contentScale,
        placeholder = remember { placeholder },
        error = remember { error },
    )
}

Version 3.0.4

贡献者指南