Pierre-Yves Ricau

L8 Android Engineer at Square

Talk Title

Root causing memory growth with LeakCanary 3

Room

Fountain Room

Date

19.09.2024

Time

14:35 > 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

I live in San Francisco, I enjoy being with my family, rollerblading, baking and reading sci-fi.

Menu