So I have a class with static UI elements like so:
class MyClass {
companion object {
lateinit var item:ChannelItem
}
}
// Item from groupie
class ChannelItem(var channel:Channel): Item<ViewHolder>() {
// bind
// getLayout
}
This seems to cause a memory leak, is there a quick way to fix it without changing the code too much?
I'm thinking about replacing the item with
var map = mutableMapOf<String, ChannelItem?>()
would this fix the memory leak? and if so why?
Thanks a lot