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

iOS. Animation crashes with OOM inside bottom sheet #5000

Open
logutenko opened this issue Jun 20, 2024 · 0 comments
Open

iOS. Animation crashes with OOM inside bottom sheet #5000

logutenko opened this issue Jun 20, 2024 · 0 comments

Comments

@logutenko
Copy link

logutenko commented Jun 20, 2024

When playing an animation inside bottom sheet, a large amount of memory is allocated. This causes an application to crash with OOM error.

Affected platforms

  • iOS

Versions

  • Libraries:
    • Compose Multiplatform: 1.6.10
  • Kotlin: 2.0.0
  • OS: 17.1.1
  • OS architecture: arm64
  • Device: iPhone 15 Pro

To Reproduce
Steps to reproduce the behavior:

  1. In the example graphics-2d replace Scaffold with ModalBottomSheet:
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun Graphics2D(requestWindowSize: ((width: Dp, height: Dp) -> Unit) = EMPTY_WINDOW_RESIZER) {
    val exampleState: MutableState<Example?> = remember { mutableStateOf(null) }
    val example = exampleState.value

    MaterialTheme(
        colorScheme = if (isSystemInDarkTheme()) darkColorScheme() else lightColorScheme()
    ) {
        ModalBottomSheet(onDismissRequest = {}) {
            if (example == null) {
                LazyColumn(Modifier.padding(horizontal = 16.dp)) {
                    items(examples) {
                        Button(onClick = {
                            exampleState.value = it
                        }) {
                            Text(it.name)
                        }
                    }
                }
            } else {
                example.content { w, h ->
                    requestWindowSize(w, h + TOP_APP_BAR_HEIGHT)
                }
            }
        }
    }
}
  1. Run an app and click on RotatingWords button
  2. OS terminates app

According to the profiler, memory consumption is over 3 GiB

Снимок экрана 2024-06-20 в 13 05 27

@logutenko logutenko added bug Something isn't working submitted labels Jun 20, 2024
@MatkovIvan MatkovIvan changed the title iOS. Animation crashes inside bottom sheet iOS. Animation crashes with OOM inside bottom sheet Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants