Describe the bug
Seems like blitz leaks the view that is attached to, here's a heap dump of the issue:
┬───
│ GC Root: Input or output parameters in native code
│
├─ android.os.MessageQueue instance
│ Leaking: NO (MessageQueue#mQuitting is false)
│ ↓ MessageQueue.mMessages
│ ~~~~~~~~~
├─ android.os.Message instance
│ Leaking: UNKNOWN
│ ↓ Message.next
│ ~~~~
├─ android.os.Message instance
│ Leaking: UNKNOWN
│ ↓ Message.callback
│ ~~~~~~~~
├─ com.perfomer.blitz.BlitzAttachListener$runnable$1 instance
│ Leaking: UNKNOWN
│ Anonymous class implementing java.lang.Runnable
│ ↓ BlitzAttachListener$runnable$1.this$0
│ ~~~~~~
├─ com.perfomer.blitz.BlitzAttachListener instance
│ Leaking: UNKNOWN
│ ↓ BlitzAttachListener.target
│ ~~~~~~
├─ androidx.appcompat.widget.AppCompatTextView instance
│ Leaking: YES (View.mContext references a destroyed activity)
│ mContext instance of co.anitrend.support.crunchyroll.ui.MainScreen with mDestroyed = true
│ View#mParent is set
│ View#mAttachInfo is null (view detached)
│ View.mID = R.id.newsPublishedOn
│ View.mWindowAttachCount = 17
│ ↓ AppCompatTextView.mContext
╰→ co.anitrend.support.crunchyroll.ui.MainScreen instance
Leaking: YES (ObjectWatcher was watching this because co.anitrend.component.MainScreen received Activity#onDestroy() callback and Activity#mDestroyed is true)
key = 331e1713-3a5a-4fdb-880e-4c188e9f4388
watchDurationMillis = 5455
retainedDurationMillis = 430
METADATA
Build.VERSION.SDK_INT: 29
Build.MANUFACTURER: Xiaomi
LeakCanary version: 2.4
App process name: co.anitrend
Analysis duration: 14157 ms
To Reproduce
Steps to reproduce the behavior:
- Create a sample application and add leak canary
- Add blitz in a recycler - view holder implementation, make sure you add
cancelTimeAgoUpdates() when the view holder is recycled
- Scroll up and down a couple of times, then exit the application or go to another activity besides the one containing the above recycler
- See error
Expected behavior
cancelTimeAgoUpdates() should take of any pending message queues for the view to avoid any potential leaks as, I have not taken a look at the codebase so I'm not yet sure about what could be done to mitigate this
Smartphone (please complete the following information):
- Device: Xiaomi Poco F1
- Android OS Version: 10
- Blitz Library Version: 1.0.9
Additional context
Other devices affected:
- Emulator(s): API 26 & 28
- Blitz Library Version: 1.0.9
Describe the bug
Seems like blitz leaks the view that is attached to, here's a heap dump of the issue:
To Reproduce
Steps to reproduce the behavior:
cancelTimeAgoUpdates()when the view holder is recycledExpected behavior
cancelTimeAgoUpdates()should take of any pending message queues for the view to avoid any potential leaks as, I have not taken a look at the codebase so I'm not yet sure about what could be done to mitigate thisSmartphone (please complete the following information):
Additional context
Other devices affected: