Fixed
Status Update
Comments
vs...@google.com <vs...@google.com>
di...@google.com <di...@google.com>
jl...@google.com <jl...@google.com> #2
Thank you for reporting the issue. This should be fixed in: Android Studio JellyFish Canary 2
an...@google.com <an...@google.com> #3
Thank you for your patience while our engineering team worked to resolve this issue. A fix for this issue is now available in:
- Android Studio Jellyfish | 2023.3.1 Canary 1
- Android Gradle Plugin 8.4.0-alpha01
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
Thank you for taking the time to submit feedback — we really appreciate it!
Description
Android Studio version
The bug is currently still present on the main branch athttps://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main
Root cause
RootsDetector.lastRootIds
, which is aSet<Long>
, accidentally references all the root views by building that set usingRootsDetector.getRootViewsOnMainThread().keys
which doesn't create a new set and under the hood keeps a reference to the map of view uniqueDrawingId to views.Here's what the current code is doing:
While
RootsDetector.lastRootIds
is aSet<Long>
, the implementation keeps a reference tocurrRoots
. See Leak Trace below:Leak Trace
Fix
Instead of referencing
currRoots.keys
, make a copy of that set into a new set of long.