'LazyList memory leak in Jetpack Compose
I found out that LazyList generates memory leaks. When I scroll down to the bottom of the list memory usage by my app increases by ~3MB. After I scroll up and usage also increases by ~3MB. Memory usage increases all the time is scroll list. How to fix it? Issue on Google IssueTracker
P.S.
Sometimes memory usage drops down by 50-100mb. In my test project(code below) usage grows up to 150mb. In my other, more complex projects it grows up to 200-250mb. In a theory it can cause OutOfMemoryException.
Example:
LazyVerticalGrid(columns = GridCells.Fixed(2)) {
item(span = { GridItemSpan(2) }) {
LargeTopAppBar(title = {
Text(text = "Explore new")
})
}
items(50) {
Box(modifier = Modifier
.fillMaxWidth()
.height(250.dp))
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|