Skip to content

WIP: Fixed BriarRecyclerView memory leak

Ernir Erlingsson requested to merge 851-recyclerview-refresher into master

Closes #851 (closed)

The BriarRecyclerView uses a postDelayed callback to update its Views. When the view is destroyed it correctly removes the callback handler but the problem is that the runnable is an anonymous inner class which retains a reference to the view, preventing the garbage collector from doing its job.

I fixed this by making the Runnable a static inner class and the difference in allocated memory is immense. Before I was easily in the hundreds of MB of allocated memory after GC, now a relatively stable 17 Mb, after GC, on my device

Merge request reports