Open hijamoya opened 4 years ago
If this is the case, then in the onDestroyView()
method of TasksFragment
we can set the viewDataBinding.tasksList.adapter = null
. Gotta still test to make sure nothing breaks 💯
is there any more elegant way to fix this memory leak?
Detected leak path by LeakCanary:
The reason is that the sample keeps a
lateinit listAdapter
inTasksFragment
. When we navigate toAddEditTaskFragment
, theRecyclerView
destroyed but the adapter is still keep the reference of it which causes the leak.Do you have any suggestion to fix this? Thanks!