There seems to be a new memory leak introduced between 1.5.0 and 1.6.0-alpha01, it also seems to exist in 1.6.0-alpha02 and 1.6.0-alpha03. There is a reference kept to AndroidViewHolder even though it's removed from the composition. Has anyone else encountered this? I'm trying to gather information for a bug report
vide
08/17/2023, 9:59 AM
Screenshot 2023-08-17 at 12.59.13.png
vide
08/17/2023, 10:08 AM
(ComposeRecyclerView) is a custom component, it's inside an AndroidView
vide
08/17/2023, 10:11 AM
this is from 1.6.0-alpha01
vide
08/17/2023, 12:54 PM
here's a minimal reproducible sample:
Copy code
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
val compose = remember { mutableStateOf(true) }
if (compose.value) {
AndroidView(factory = {
object : View(it) { val alloc = List(1024 * 1024) { 0 } }
})
}
LaunchedEffect(Unit) {
while (true) {
compose.value = !compose.value
delay(10)
}
}
}
}
}
Thought to post an update to the channel as well as a warning: it seems like 1.6.0-alpha01 and later alpha versions do have a bug that will leak memory if you use