I had missed this great article that dives into AS leak detection, it's fair and well constructed.

🧵on computing shortest paths ⬇️ https://twitter.com/LukasLechnerDev/status/1233409335969144832
The LeakCanary doc says it finds the "best strong reference path from garbage collection roots to a retained object."

"best" is a poor choice of word from me, but I couldn't find a short & accurate one.
It's more of a shorter path where some paths have lower priority than other:

- Ignored: weak / phantom / finalization related refs, java locals on main thread
- Lower priority: Java local refs
- Lowest priority: Refs matching known leak patterns
So LeakCanary finds the shortest path that also validates those priority rules.
Why shortest? Any path would work,all of the path mist have the faulty ref on them. So might as well pick shortest, less information to dig through
Java local refs are typically hard to understand because we don't have the variable name. If there's a longer path not involving a java local ref, that's easier to understand!
Known leak patterns have lowest priority so that if a leak has two distinct causes one of which is a known leak, we want to surface the unknown one instead.
Let me know if there's any follow up question!
You can follow @Piwai.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled: