Closed
Bug 1917080
Opened 2 years ago
Closed 2 years ago
HomeMenuView causes memory leak of org.mozilla.fenix.home.HomeFragment
Categories
(Firefox for Android :: Toolbar, defect, P3)
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: jonalmeida, Unassigned)
References
(Blocks 1 open bug, Regression)
Details
(Keywords: regression)
Steps to reproduce
- Disable the second bottom navbar.
- Navigate between the home and browser views while opening the three-dot menu in-between.
LeakCanary trace
┬───
│ GC Root: Thread object
│
├─ java.lang.Thread instance
│ Leaking: UNKNOWN
│ Retaining 258 B in 8 objects
│ Thread name: 'Studio:LayInsp'
│ ↓ Thread.target
│ ~~~~~~
├─ com.android.tools.agent.appinspection.RootsDetector$start$1 instance
│ Leaking: UNKNOWN
│ Retaining 12 B in 1 objects
│ ↓ RootsDetector$start$1.this$0
│ ~~~~~~
├─ com.android.tools.agent.appinspection.RootsDetector instance
│ Leaking: UNKNOWN
│ Retaining 367 B in 14 objects
│ ↓ RootsDetector.onRootsChanged
│ ~~~~~~~~~~~~~~
├─ com.android.tools.agent.appinspection.ViewLayoutInspector$rootsDetector$1
│ instance
│ Leaking: UNKNOWN
│ Retaining 70 B in 2 objects
│ Anonymous subclass of com.android.tools.idea.kotlin.jvm.internal.
│ FunctionReferenceImpl
│ ↓ CallableReference.receiver
│ ~~~~~~~~
├─ com.android.tools.agent.appinspection.ViewLayoutInspector instance
│ Leaking: UNKNOWN
│ Retaining 145 B in 7 objects
│ ↓ ViewLayoutInspector.foldSupport
│ ~~~~~~~~~~~
├─ com.android.tools.agent.appinspection.FoldSupport instance
│ Leaking: UNKNOWN
│ Retaining 58 B in 3 objects
│ ↓ FoldSupport.observer
│ ~~~~~~~~
├─ com.android.tools.agent.nojarjar.FoldObserverImpl instance
│ Leaking: UNKNOWN
│ Retaining 19.8 MB in 177937 objects
│ ↓ FoldObserverImpl.listeners
│ ~~~~~~~~~
├─ java.util.LinkedHashMap instance
│ Leaking: UNKNOWN
│ Retaining 19.8 MB in 177924 objects
│ ↓ LinkedHashMap[key()]
│ ~~~~~~~
├─ android.widget.PopupWindow$PopupDecorView instance
│ Leaking: UNKNOWN
│ Retaining 1.9 MB in 26459 objects
│ View not part of a window view hierarchy
│ View.mAttachInfo is null (view detached)
│ View.mWindowAttachCount = 1
│ mContext instance of org.mozilla.fenix.HomeActivity with mDestroyed = false
│ ↓ PopupWindow$PopupDecorView.this$0
│ ~~~~~~
├─ android.widget.PopupWindow instance
│ Leaking: UNKNOWN
│ Retaining 343 B in 12 objects
│ mContext instance of org.mozilla.fenix.HomeActivity with mDestroyed = false
│ ↓ PopupWindow.mOnDismissListener
│ ~~~~~~~~~~~~~~~~~~
├─ mozilla.components.browser.menu.BrowserMenu$$ExternalSyntheticLambda0
│ instance
│ Leaking: UNKNOWN
│ Retaining 32 B in 2 objects
│ ↓ BrowserMenu$$ExternalSyntheticLambda0.f$0
│ ~~~
├─ mozilla.components.browser.menu.BrowserMenu instance
│ Leaking: UNKNOWN
│ Retaining 79 B in 3 objects
│ ↓ BrowserMenu.currAnchor
│ ~~~~~~~~~~
├─ mozilla.components.browser.menu.view.MenuButton instance
│ Leaking: UNKNOWN
│ Retaining 71.0 kB in 1249 objects
│ View not part of a window view hierarchy
│ View.mAttachInfo is null (view detached)
│ View.mID = R.id.menuButton
│ View.mWindowAttachCount = 1
│ mContext instance of org.mozilla.fenix.HomeActivity with mDestroyed = false
│ ↓ MenuButton.$$delegate_0
│ ~~~~~~~~~~~~
├─ mozilla.components.support.base.observer.ObserverRegistry instance
│ Leaking: UNKNOWN
│ Retaining 713 B in 24 objects
│ ↓ ObserverRegistry.observers
│ ~~~~~~~~~
├─ java.util.LinkedHashSet instance
│ Leaking: UNKNOWN
│ Retaining 225 B in 8 objects
│ ↓ LinkedHashSet[element()]
│ ~~~~~~~~~~~
├─ org.mozilla.fenix.home.HomeMenuView$build$4 instance
│ Leaking: UNKNOWN
│ Retaining 12 B in 1 objects
│ Anonymous class implementing mozilla.components.concept.menu.
│ MenuButton$Observer
│ ↓ HomeMenuView$build$4.this$0
│ ~~~~~~
├─ org.mozilla.fenix.home.HomeMenuView instance
│ Leaking: UNKNOWN
│ Retaining 104 B in 4 objects
│ context instance of org.mozilla.fenix.HomeActivity with mDestroyed = false
│ homeActivity instance of org.mozilla.fenix.HomeActivity with mDestroyed =
│ false
│ ↓ HomeMenuView.homeFragment
│ ~~~~~~~~~~~~
╰→ org.mozilla.fenix.home.HomeFragment instance
Leaking: YES (ObjectWatcher was watching this because org.mozilla.fenix.
home.HomeFragment received Fragment#onDestroy() callback. Conflicts with
Fragment.mLifecycleRegistry.state is INITIALIZED)
Retaining 4.0 kB in 136 objects
key = 05426557-3d0b-43fd-8eeb-3ace328d6acb
watchDurationMillis = 53753
retainedDurationMillis = 48734
METADATA
Build.VERSION.SDK_INT: 34
Build.MANUFACTURER: Google
LeakCanary version: 2.14
App process name: org.mozilla.fenix.debug
Class count: 48008
Instance count: 529394
Primitive array count: 234355
Object array count: 83815
Thread count: 121
Heap total bytes: 53930752
Bitmap count: 159
Bitmap total bytes: 12765855
Large bitmap count: 0
Large bitmap total bytes: 0
Db 1: open /data/user/0/org.mozilla.fenix.debug/databases/tab_collections
Db 2: open /data/user/0/org.mozilla.fenix.debug/databases/top_sites
Db 3: open /data/user/0/org.mozilla.fenix.debug/databases/manifests
Db 4: open /data/user/0/org.mozilla.fenix.debug/databases/recently_closed_tabs
Db 5: open /data/user/0/org.mozilla.fenix.
debug/databases/mozac_downloads_database
Db 6: open /data/user/0/org.mozilla.fenix.debug/no_backup/androidx.work.workdb
Db 7: open /data/user/0/org.mozilla.fenix.debug/databases/pocket_recommendations
Db 8: closed /data/user/0/org.mozilla.fenix.debug/databases/leaks.db
Count of retained yet cleared: 1 KeyedWeakReference instances
Stats: LruCache[maxSize=3000,hits=197303,misses=482434,hitRate=29%]
RandomAccess[bytes=25985327,reads=482434,travel=231072557309,range=69180771,size
=79054852]
Analysis duration: 20794 ms
Flags: needinfo?(smathiyarasan)
| Reporter | ||
Updated•2 years ago
|
status-firefox130:
--- → affected
status-firefox131:
--- → affected
status-firefox132:
--- → affected
| Reporter | ||
Comment 1•2 years ago
|
||
Spoke offline with sanchaai - we can't reproduce this leak with these STR, so I suspect it was some other STR that caused it. Redirecting the NI to me for now so I can try to update them with correct STR or otherwise close it.
That said, I think the trace points a fix that we can land either way: make the MenuButton.Observer in the HomeMenuView follow a lifecycle(1) or explicitly unregister it somewhere in the code where we destroy the view.
(1): I see a lifecycleOwner in the HomeMenuView that we could pass into the register method as the owner.
Flags: needinfo?(smathiyarasan) → needinfo?(jonalmeida942)
Updated•2 years ago
|
Comment 2•2 years ago
|
||
Adding this bug to our menu release blockers so we can track whether Jonathan sees the problem again.
Updated•2 years ago
|
| Reporter | ||
Comment 3•2 years ago
|
||
Closing because I haven't had a chance to run into this leak again since then. ¯\_(ツ)_/¯
Status: NEW → RESOLVED
Closed: 2 years ago
Flags: needinfo?(jonalmeida942)
Resolution: --- → WORKSFORME
Updated•2 years ago
|
You need to log in
before you can comment on or make changes to this bug.
Description
•