Pierre-Yves Ricau

Android Plumber

Talk Title

Cutting Edges: universal heap trimming with LeakCanary 3







on Twitter

At Square, we have scaled our LeakCanary usage over the last nine years by running it on all UI tests on every pull request, uploading leaks detected in debug builds, and triaging leaks weekly. This works: we haveve fixed thousands of leaks (in our apps, third-party libraries, and the Android Framework), and we're now finding fewer and fewer new leaks!

Unfortunately, we are sometimes still seeing the heap size grow over time, without LeakCanary finding any issue. For example, constantly appending string logs to a collection would not trigger LeakCanary but will still lead to ANRs and OOMEs when the app eventually runs out of memory.

Inspired by the BLeak paper and work from the Android Studio team, I built a new toolkit in LeakCanary that performs repeated heap dump diffs and detects objects that have a constantly increasing number of outgoing edges (for example, a list that keeps growing).

Come learn how this work, and together, we can fix all the leaks!

Speaker Bio

My pronouns are he / him. I’m currently working as an Android Distinguished Engineer at Square.