Open LukasPaczos opened 3 years ago
Cross-posting from https://github.com/mapbox/mapbox-navigation-android/pull/3758#issuecomment-733991877 for reference
After rotating back to portrait there's a leak
┬───
│ GC Root: Input or output parameters in native code
│
├─ com.mapbox.mapboxsdk.maps.MapView$5 instance
│ Leaking: NO (MapboxGLSurfaceView↓ is not leaking)
│ Anonymous subclass of com.mapbox.mapboxsdk.maps.renderer.glsurfaceview.GLSurfaceViewMapRenderer
│ ↓ MapView$5.glSurfaceView
├─ com.mapbox.mapboxsdk.maps.renderer.glsurfaceview.MapboxGLSurfaceView instance
│ Leaking: NO (FeedbackOptionsActivity↓ is not leaking and View attached)
│ mContext instance of com.mapbox.navigation.examples.ui.FeedbackOptionsActivity with mDestroyed = false
│ View.parent com.mapbox.mapboxsdk.maps.MapView attached as well
│ View#mParent is set
│ View#mAttachInfo is not null (view attached)
│ View.mWindowAttachCount = 1
│ ↓ MapboxGLSurfaceView.mContext
├─ com.mapbox.navigation.examples.ui.FeedbackOptionsActivity instance
│ Leaking: NO (FeedbackArrivalFragment↓ is not leaking and Activity#mDestroyed is false)
│ ↓ FeedbackOptionsActivity.mOnBackPressedDispatcher
├─ androidx.activity.OnBackPressedDispatcher instance
│ Leaking: NO (FeedbackArrivalFragment↓ is not leaking)
│ ↓ OnBackPressedDispatcher.mOnBackPressedCallbacks
├─ java.util.ArrayDeque instance
│ Leaking: NO (FeedbackArrivalFragment↓ is not leaking)
│ ↓ ArrayDeque.elements
├─ java.lang.Object[] array
│ Leaking: NO (FeedbackArrivalFragment↓ is not leaking)
│ ↓ Object[].[1]
├─ androidx.fragment.app.FragmentManager$1 instance
│ Leaking: NO (FeedbackArrivalFragment↓ is not leaking)
│ Anonymous subclass of androidx.activity.OnBackPressedCallback
│ ↓ FragmentManager$1.this$0
├─ androidx.fragment.app.FragmentManagerImpl instance
│ Leaking: NO (FeedbackArrivalFragment↓ is not leaking)
│ ↓ FragmentManagerImpl.mParent
├─ com.mapbox.navigation.ui.internal.feedback.FeedbackArrivalFragment instance
│ Leaking: NO (Fragment#mFragmentManager is not null)
│ Fragment.mTag=FeedbackArrivalFragment
│ ↓ FeedbackArrivalFragment.feedbackSubTypeAdapter
│ ~~~~~~~~~~~~~~~~~~~~~~
├─ com.mapbox.navigation.ui.feedback.FeedbackSubTypeAdapter instance
│ Leaking: UNKNOWN
│ ↓ FeedbackSubTypeAdapter.mObservable
│ ~~~~~~~~~~~
├─ androidx.recyclerview.widget.RecyclerView$AdapterDataObservable instance
│ Leaking: UNKNOWN
│ ↓ RecyclerView$AdapterDataObservable.mObservers
│ ~~~~~~~~~~
├─ java.util.ArrayList instance
│ Leaking: UNKNOWN
│ ↓ ArrayList.elementData
│ ~~~~~~~~~~~
├─ java.lang.Object[] array
│ Leaking: UNKNOWN
│ ↓ Object[].[0]
│ ~~~
├─ androidx.recyclerview.widget.RecyclerView$RecyclerViewDataObserver instance
│ Leaking: UNKNOWN
│ ↓ RecyclerView$RecyclerViewDataObserver.this$0
│ ~~~~~~
├─ androidx.recyclerview.widget.RecyclerView instance
│ Leaking: YES (View.mContext references a destroyed activity)
│ mContext instance of com.mapbox.navigation.examples.ui.FeedbackOptionsActivity with mDestroyed = true
│ View#mParent is set
│ View#mAttachInfo is null (view detached)
│ View.mID = R.id.feedbackSubTypes
│ View.mWindowAttachCount = 1
│ ↓ RecyclerView.mContext
╰→ com.mapbox.navigation.examples.ui.FeedbackOptionsActivity instance
Leaking: YES (ObjectWatcher was watching this because com.mapbox.navigation.examples.ui.FeedbackOptionsActivity received Activity#onDestroy() callback and Activity#mDestroyed is true)
key = e9f14571-fe4b-441d-aabe-8cdb647fb583
watchDurationMillis = 5587
retainedDurationMillis = 587
METADATA
Build.VERSION.SDK_INT: 29
Build.MANUFACTURER: Google
LeakCanary version: 2.3
App process name: com.mapbox.navigation.examples
Analysis duration: 30503 ms
cc'ing @RingerJK for visibility
Thanks for using the Mapbox Navigation SDK for Android and being a valued customer.
Mapbox will be soon deprecating any support for v0
and v1
versions of the SDK. To facilitate this transition we’re launching a new drop-in UI component into v2
, equivalent to the existing NavigationView
v1
in its design goals, however with a more modern and customizable API.
We plan to launch this new drop-in UI component as a Developer Preview feature in April, as part of the v2.5
series. Since you are using NavigationView
with v1
, we’d love to hear your feedback so that we can incorporate it ahead of a GA release.
If you’re interested in having early access to the upcoming drop-in UI for v2
and its documentation, drop a comment on this ticket or send an email to abhishek.kejriwal@mapbox.com
/cc @zugaldia @AhmerKhan1
Refs https://github.com/mapbox/mapbox-navigation-android/pull/3758#issuecomment-733991877.
When used with
NavigationView
theFeedbackArrivalFragment
leaks the contents of the activity on recreation, most likely tied to the feedback flow listener which is part of theNavigationView
'sViewModel
but is kept by the recycler in the feedback fragment.cc @Guardiola31337