Pierre-Yves Ricau

Android Plumber

Talk Title

Cutting Edges: universal heap trimming with LeakCanary 3

Room

Fisher West/DPE Track

Date

07.06.2024

Time

15:15 > 40 min

Share

on Twitter

At Square, we 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 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 sometimes see 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 would still lead to ANRs and OOMEs when the app eventually runs out of memory.

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

Come learn how this works; 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.

Menu