Leak Canary reports ConnectionFragment.binding as having a distinct leak
Using the 425e2e1d version of the vpn, on a google pixel 4a(5g), running calyxOS. I get often a LeakCanary reporting a problem.
This is the leak trace that I printed to Logcat, I am not sure which pieces are useful to share, but I can provide more:
08-11 11:14:04.988 22504 22535 D LeakCanary: LeakCanary is running and ready to detect memory leaks.
08-11 11:20:59.863 22504 22504 D LeakCanary:
08-11 11:20:59.863 22504 22504 D LeakCanary: ┬───
08-11 11:20:59.863 22504 22504 D LeakCanary: │ GC Root: System class
08-11 11:20:59.863 22504 22504 D LeakCanary: │
08-11 11:20:59.863 22504 22504 D LeakCanary: ├─ android.app.ActivityThread class
08-11 11:20:59.863 22504 22504 D LeakCanary: │ Leaking: NO (MainActivity↓ is not leaking and a class is never leaking)
08-11 11:20:59.863 22504 22504 D LeakCanary: │ ↓ static ActivityThread.sCurrentActivityThread
08-11 11:20:59.863 22504 22504 D LeakCanary: ├─ android.app.ActivityThread instance
08-11 11:20:59.863 22504 22504 D LeakCanary: │ Leaking: NO (MainActivity↓ is not leaking)
08-11 11:20:59.863 22504 22504 D LeakCanary: │ mInitialApplication instance of org.torproject.vpn.TorApplication
08-11 11:20:59.863 22504 22504 D LeakCanary: │ mSystemContext instance of android.app.ContextImpl
08-11 11:20:59.863 22504 22504 D LeakCanary: │ ↓ ActivityThread.mActivities
08-11 11:20:59.863 22504 22504 D LeakCanary: ├─ android.util.ArrayMap instance
08-11 11:20:59.863 22504 22504 D LeakCanary: │ Leaking: NO (MainActivity↓ is not leaking)
08-11 11:20:59.863 22504 22504 D LeakCanary: │ ↓ ArrayMap.mArray
08-11 11:20:59.863 22504 22504 D LeakCanary: ├─ java.lang.Object[] array
08-11 11:20:59.863 22504 22504 D LeakCanary: │ Leaking: NO (MainActivity↓ is not leaking)
08-11 11:20:59.863 22504 22504 D LeakCanary: │ ↓ Object[1]
08-11 11:20:59.863 22504 22504 D LeakCanary: ├─ android.app.ActivityThread$ActivityClientRecord instance
08-11 11:20:59.863 22504 22504 D LeakCanary: │ Leaking: NO (MainActivity↓ is not leaking)
08-11 11:20:59.863 22504 22504 D LeakCanary: │ activity instance of org.torproject.vpn.MainActivity with mDestroyed = false
08-11 11:20:59.863 22504 22504 D LeakCanary: │ ↓ ActivityThread$ActivityClientRecord.activity
08-11 11:20:59.863 22504 22504 D LeakCanary: ├─ org.torproject.vpn.MainActivity instance
08-11 11:20:59.863 22504 22504 D LeakCanary: │ Leaking: NO (ConnectionFragment↓ is not leaking and Activity#mDestroyed is false)
08-11 11:20:59.863 22504 22504 D LeakCanary: │ mApplication instance of org.torproject.vpn.TorApplication
08-11 11:20:59.863 22504 22504 D LeakCanary: │ mBase instance of androidx.appcompat.view.ContextThemeWrapper
08-11 11:20:59.863 22504 22504 D LeakCanary: │ ↓ ComponentActivity.mOnConfigurationChangedListeners
08-11 11:20:59.863 22504 22504 D LeakCanary: ├─ java.util.concurrent.CopyOnWriteArrayList instance
08-11 11:20:59.863 22504 22504 D LeakCanary: │ Leaking: NO (ConnectionFragment↓ is not leaking)
08-11 11:20:59.863 22504 22504 D LeakCanary: │ ↓ CopyOnWriteArrayList[5]
08-11 11:20:59.863 22504 22504 D LeakCanary: ├─ androidx.fragment.app.FragmentManager$$ExternalSyntheticLambda0 instance
08-11 11:20:59.863 22504 22504 D LeakCanary: │ Leaking: NO (ConnectionFragment↓ is not leaking)
08-11 11:20:59.863 22504 22504 D LeakCanary: │ ↓ FragmentManager$$ExternalSyntheticLambda0.f$0
08-11 11:20:59.863 22504 22504 D LeakCanary: ├─ androidx.fragment.app.FragmentManagerImpl instance
08-11 11:20:59.863 22504 22504 D LeakCanary: │ Leaking: NO (ConnectionFragment↓ is not leaking)
08-11 11:20:59.863 22504 22504 D LeakCanary: │ ↓ FragmentManager.mParent
08-11 11:20:59.863 22504 22504 D LeakCanary: ├─ org.torproject.vpn.ui.connectionsettings.ConnectionFragment instance
08-11 11:20:59.863 22504 22504 D LeakCanary: │ Leaking: NO (Fragment#mFragmentManager is not null)
08-11 11:20:59.863 22504 22504 D LeakCanary: │ Fragment.mTag=a2ad2df2-7ab9-468b-87c5-c4f7355dccb2
08-11 11:20:59.863 22504 22504 D LeakCanary: │ ↓ ConnectionFragment.binding
08-11 11:20:59.863 22504 22504 D LeakCanary: │ ~~~~~~~
08-11 11:20:59.863 22504 22504 D LeakCanary: ├─ org.torproject.vpn.databinding.FragmentConnectionsettingsBindingImpl instance
08-11 11:20:59.863 22504 22504 D LeakCanary: │ Leaking: UNKNOWN
08-11 11:20:59.863 22504 22504 D LeakCanary: │ Retaining 464.4 kB in 4226 objects
08-11 11:20:59.863 22504 22504 D LeakCanary: │ ↓ ViewDataBinding.mRoot
08-11 11:20:59.863 22504 22504 D LeakCanary: │ ~~~~~
08-11 11:20:59.863 22504 22504 D LeakCanary: ╰→ androidx.coordinatorlayout.widget.CoordinatorLayout instance
08-11 11:20:59.863 22504 22504 D LeakCanary: Leaking: YES (ObjectWatcher was watching this because org.torproject.vpn.ui.connectionsettings.ConnectionFragment
08-11 11:20:59.863 22504 22504 D LeakCanary: received Fragment#onDestroyView() callback (references to its views should be cleared to prevent leaks))
08-11 11:20:59.863 22504 22504 D LeakCanary: Retaining 2.7 kB in 71 objects
08-11 11:20:59.863 22504 22504 D LeakCanary: key = 67f37547-40c5-44fc-a4de-cac3c33512f6
08-11 11:20:59.863 22504 22504 D LeakCanary: watchDurationMillis = 31085
08-11 11:20:59.863 22504 22504 D LeakCanary: retainedDurationMillis = 26083
08-11 11:20:59.863 22504 22504 D LeakCanary: View not part of a window view hierarchy
08-11 11:20:59.863 22504 22504 D LeakCanary: View.mAttachInfo is null (view detached)
08-11 11:20:59.863 22504 22504 D LeakCanary: View.mWindowAttachCount = 1
08-11 11:20:59.863 22504 22504 D LeakCanary: mContext instance of org.torproject.vpn.MainActivity with mDestroyed = false
08-11 11:20:59.863 22504 22504 D LeakCanary:
08-11 11:20:59.863 22504 22504 D LeakCanary: METADATA
08-11 11:20:59.863 22504 22504 D LeakCanary:
08-11 11:20:59.863 22504 22504 D LeakCanary: Build.VERSION.SDK_INT: 33
08-11 11:20:59.863 22504 22504 D LeakCanary: Build.MANUFACTURER: Google
08-11 11:20:59.863 22504 22504 D LeakCanary: LeakCanary version: 2.9.1
08-11 11:20:59.863 22504 22504 D LeakCanary: App process name: org.torproject.vpn
08-11 11:20:59.863 22504 22504 D LeakCanary: Class count: 25281
08-11 11:20:59.863 22504 22504 D LeakCanary: Instance count: 191621
08-11 11:20:59.863 22504 22504 D LeakCanary: Primitive array count: 129463
08-11 11:20:59.863 22504 22504 D LeakCanary: Object array count: 24642
08-11 11:20:59.863 22504 22504 D LeakCanary: Thread count: 29
08-11 11:20:59.863 22504 22504 D LeakCanary: Heap total bytes: 26478243
08-11 11:20:59.863 22504 22504 D LeakCanary: Bitmap count: 1
08-11 11:20:59.863 22504 22504 D LeakCanary: Bitmap total bytes: 222481
08-11 11:20:59.863 22504 22504 D LeakCanary: Large bitmap count: 0
08-11 11:20:59.863 22504 22504 D LeakCanary: Large bitmap total bytes: 0
08-11 11:20:59.863 22504 22504 D LeakCanary: Stats: LruCache[maxSize=3000,hits=115115,misses=192140,hitRate=37%]
08-11 11:20:59.863 22504 22504 D LeakCanary: RandomAccess[bytes=9849438,reads=192140,travel=93180964532,range=31716041,size=39433354]
08-11 11:20:59.863 22504 22504 D LeakCanary: Analysis duration: 9444 ms
Edited by micah