Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
CoordinatorLayout.mPreSortedChildren retains references to Views from destroyed Fragments #1983
Comments
|
Interesting! So it looks like Can you provide the versions and manufacturers you've reproduced this on? Looking at the latest ViewGroup sources, I can see
However, looking at the source, that array list is filled by one method and call sites typically clear the list right after using it. There are three call sites that don't clear: Can you file a bug to AOSP and link it here? Also it's interesting we haven't had reports yet, so you might run into a special case and it's worth reproducing with an example app. Once you have filed an issue, can you link it here? Then we can add it to the library leaks. |
|
I'll file the issue soon. Trying to clear up some time so I can test whether it's a special case, or if it's a general issue. |
I have a CoordinatorLayout that I am using as a fragment container, and I started getting leak reports after fragments are getting destroyed, because their View's are referenced by the container's
mPreSortedChildren.Looking at the ViewGroup source, it seems like that gets cleared when
buildOrderedChildListis called, but I'm not fully sure what would trigger that (seems like adrawwill, but not sure if there are conditions).Is there something LeakCanary (or plumber) can do about that, or would it have to be a framework fix (I can repro on a Pixel 2 running Android 11)?
Using LeakCanary 2.4
LeakTrace information