coil-kt/coil

IOS App crashes with `didReceiveMemoryWarning`

Open

#2,765 建立於 2024年12月28日

在 GitHub 查看
 (7 留言) (0 反應) (0 負責人)Kotlin (757 fork)batch import
help wanted

倉庫指標

Star
 (11,779 star)
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

貢獻者指南