There seems to be a new memory leak introduced bet...
# compose
v
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
Screenshot 2023-08-17 at 12.59.13.png
(ComposeRecyclerView) is a custom component, it's inside an AndroidView
this is from 1.6.0-alpha01
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
AndroidView
inside the composition.
thank you color 2