Fixed
Status Update
Comments
as...@google.com <as...@google.com>
ca...@google.com <ca...@google.com> #2
Hi, thanks for report!
Could you attach a bit more information about the heap at this point (e.g. a heap dump) if the leak is not reproducible in trivial project?
it...@gmail.com <it...@gmail.com> #3
Attached!
ca...@google.com <ca...@google.com> #4
I looked into the heap dump, seems like we are not disposing certain snapshots. Current snapshot id seems to be around 42k, but we have 108, 116 and 14123 in invalid SnapshotIdSet
for current global snapshot.
It is hard to figure out what caused it without repro though, as those snapshots seem to be already collected by GC.
it...@gmail.com <it...@gmail.com> #5
I managed to repro it after a bunch of debugging. The bad news is that it's caused when using
Repro:
- Add
implementation io.coil-kt:coil-compose:2.1.0
to build.gradle - Add the following composable:
@Composable fun Leak() {
val lazyListState = rememberLazyListState()
val items by remember { mutableStateOf(List(10000) { it }) }
LazyColumn(state = lazyListState) {
items(items) {
Box(Modifier.fillMaxWidth()) {
AsyncImage(
model = "https://i.picsum.photos/id/104/200/200.jpg?hmac=3XxEVXVjwoI45-6sum_iMwNZ52GT-SJacVWr4fh4hqI",
contentDescription = null
)
}
}
}
}
- Scroll
- Memory 📈
ca...@google.com <ca...@google.com>
ap...@google.com <ap...@google.com> #6
Project: platform/frameworks/support
Branch: androidx-main
commit e82b3518094e5451dd4697f31a412c10075b28c5
Author: Andrei Shikov <ashikov@google.com>
Date: Wed Jul 20 23:43:58 2022
Dispose nested snapshots created from transparent snapshots
Adds a flag to transparent snapshots to "manage" wrapped snapshots which forces dispose of the wrapped snapshot whenever transparent one is disposed.
This flag is only enabled for the snapshots taken inside transparent snapshots, fixing memory leaks in certain conditions.
Fixes a minor bug where transparent snapshot wasn't receiving reads from nested snapshots as well.
Fixes: 239603305
Test: SnapshotTests#testNestedWithinTransparentSnapshotDisposedCorrectly
Change-Id: I62eddd279c8cf44b032d852d646c9ba21ad08a39
M compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/snapshots/Snapshot.kt
M compose/runtime/runtime/src/commonTest/kotlin/androidx/compose/runtime/snapshots/SnapshotTests.kt
https://android-review.googlesource.com/2160780
Branch: androidx-main
commit e82b3518094e5451dd4697f31a412c10075b28c5
Author: Andrei Shikov <ashikov@google.com>
Date: Wed Jul 20 23:43:58 2022
Dispose nested snapshots created from transparent snapshots
Adds a flag to transparent snapshots to "manage" wrapped snapshots which forces dispose of the wrapped snapshot whenever transparent one is disposed.
This flag is only enabled for the snapshots taken inside transparent snapshots, fixing memory leaks in certain conditions.
Fixes a minor bug where transparent snapshot wasn't receiving reads from nested snapshots as well.
Fixes: 239603305
Test: SnapshotTests#testNestedWithinTransparentSnapshotDisposedCorrectly
Change-Id: I62eddd279c8cf44b032d852d646c9ba21ad08a39
M compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/snapshots/Snapshot.kt
M compose/runtime/runtime/src/commonTest/kotlin/androidx/compose/runtime/snapshots/SnapshotTests.kt
Description
androidx.core:core-splashscreen
1.0.0-beta01
Theme.SplashScreen
False
Pixel 4a (5G) (Android 11)
A small number of users are affected by this crash (report via
Crahlytics
) & it seems to be very device-specific (mentioned above).Stacktrace:
The
handleSeamlessEnd
extension method: