TeamAmaze / TeamAmaze/AmazeFileManager

Leak found when entering FTP server fragment from file list

Open
#2,512 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-CodeHealth Issue-Bug Issue-Task (low)
Dominant language
Kotlin
Stars
6.4k
Forks
1.7k
Avg merge
3d 9h
Merged PRs (30d)
1

Description

When leaving file list to FTP server via Drawer, got this. Fairphone 3 running LineageOS 16.0 (9.0).

┬───
│ GC Root: System class
│
├─ android.view.inputmethod.InputMethodManager class
│    Leaking: NO (InputMethodManager↓ is not leaking and a class is never
│    leaking)
│    ↓ static InputMethodManager.sInstance
├─ android.view.inputmethod.InputMethodManager instance
│    Leaking: NO (DecorView↓ is not leaking and InputMethodManager is a
│    singleton)
│    ↓ InputMethodManager.mNextServedView
├─ com.android.internal.policy.DecorView instance
│    Leaking: NO (LinearLayout↓ is not leaking and View attached)
│    View is part of a window view hierarchy
│    View.mAttachInfo is not null (view attached)
│    View.mWindowAttachCount = 1
│    mContext instance of com.android.internal.policy.DecorContext, wrapping
│    activity com.amaze.filemanager.ui.activities.MainActivity with mDestroyed
│    = false
│    ↓ DecorView.mContentRoot
├─ android.widget.LinearLayout instance
│    Leaking: NO (MainActivity↓ is not leaking and View attached)
│    View is part of a window view hierarchy
│    View.mAttachInfo is not null (view attached)
│    View.mWindowAttachCount = 1
│    mContext instance of com.amaze.filemanager.ui.activities.MainActivity with
│    mDestroyed = false
│    ↓ View.mContext
├─ com.amaze.filemanager.ui.activities.MainActivity instance
│    Leaking: NO (LinearLayout↓ is not leaking and Activity#mDestroyed is false)
│    mainActivity instance of com.amaze.filemanager.ui.activities.MainActivity
│    with mDestroyed = false
│    mApplication instance of com.amaze.filemanager.application.AppConfig
│    mBase instance of androidx.appcompat.view.ContextThemeWrapper
│    ↓ MainActivity.indicator_layout
├─ android.widget.LinearLayout instance
│    Leaking: NO (Indicator↓ is not leaking and View attached)
│    View is part of a window view hierarchy
│    View.mAttachInfo is not null (view attached)
│    View.mID = R.id.indicator_layout
│    View.mWindowAttachCount = 1
│    mContext instance of com.amaze.filemanager.ui.activities.MainActivity with
│    mDestroyed = false
│    ↓ ViewGroup.mChildren
├─ android.view.View[] array
│    Leaking: NO (Indicator↓ is not leaking)
│    ↓ View[].[0]
├─ com.amaze.filemanager.ui.views.Indicator instance
│    Leaking: NO (View attached)
│    View is part of a window view hierarchy
│    View.mAttachInfo is not null (view attached)
│    View.mID = R.id.indicator
│    View.mWindowAttachCount = 1
│    mContext instance of com.amaze.filemanager.ui.activities.MainActivity with
│    mDestroyed = false
│    ↓ Indicator.viewPager
│                ~~~~~~~~~
├─ com.amaze.filemanager.ui.views.DisablableViewPager instance
│    Leaking: UNKNOWN
│    Retaining 95.2 kB in 1349 objects
│    View not part of a window view hierarchy
│    View.mAttachInfo is null (view detached)
│    View.mID = R.id.pager
│    View.mWindowAttachCount = 1
│    mContext instance of com.amaze.filemanager.ui.activities.MainActivity with
│    mDestroyed = false
│    ↓ View.mParent
│           ~~~~~~~
╰→ androidx.constraintlayout.widget.ConstraintLayout instance
      Leaking: YES (ObjectWatcher was watching this because com.amaze.
      filemanager.ui.fragments.TabFragment received Fragment#onDestroyView()
      callback (references to its views should be cleared to prevent leaks))
      Retaining 3.3 kB in 53 objects
      key = 603e3621-47d5-4d7d-a553-8a163a3d6a94
      watchDurationMillis = 7966
      retainedDurationMillis = 2962
      View not part of a window view hierarchy
      View.mAttachInfo is null (view detached)
      View.mWindowAttachCount = 1
      mContext instance of com.amaze.filemanager.ui.activities.MainActivity
      with mDestroyed = false

METADATA

Build.VERSION.SDK_INT: 28
Build.MANUFACTURER: Fairphone
LeakCanary version: 2.6
App process name: com.amaze.filemanager.debug
Stats: LruCache[maxSize=3000,hits=11560,misses=112058,hitRate=9%]
RandomAccess[bytes=6770846,reads=112058,travel=37618357670,range=28381625,size=3
3371989]
Heap dump reason: user request
Analysis duration: 10947 ms

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing TabFragment's onDestroyView() lifecycle and the references from Indicator to DisablableViewPager shown in the LeakCanary report. Reproduce the navigation from the file list to an FTP server through the Drawer on Android, then verify that the reported view hierarchy is no longer retained after the fragment view is destroyed.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile-dev, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.