5HT2B/heartbeat-android

Memory leak - StatusFragment.updateReceiver

Closed this issue · 1 comments

Leak dump from LeakCanary:

┬───
│ GC Root: Thread object
│
├─ android.os.HandlerThread instance
│    Leaking: NO (PathClassLoader↓ is not leaking)
│    Thread name: 'LeakCanary-Heap-Dump'
│    ↓ Thread.contextClassLoader
├─ dalvik.system.PathClassLoader instance
│    Leaking: NO (StatusFragment↓ is not leaking and A ClassLoader is never
│    leaking)
│    ↓ ClassLoader.runtimeInternalObjects
├─ java.lang.Object[] array
│    Leaking: NO (StatusFragment↓ is not leaking)
│    ↓ Object[480]
├─ com.technicallyfunctional.digitalheartbeat.StatusFragment class
│    Leaking: NO (a class is never leaking)
│    ↓ static StatusFragment.updateReceiver
│                            ~~~~~~
├─ com.technicallyfunctional.digitalheartbeat.StatusFragment$UpdateReceiver
│  instance
│    Leaking: UNKNOWN
│    Retaining 193.5 kB in 3067 objects
│    ↓ BroadcastReceiver.mPendingResult
│                        ~~~~~~
├─ android.app.LoadedApk$ReceiverDispatcher$Args instance
│    Leaking: UNKNOWN
│    Retaining 193.5 kB in 3066 objects
│    ↓ LoadedApk$ReceiverDispatcher$Args.this$0
│                                        ~~
├─ android.app.LoadedApk$ReceiverDispatcher instance
│    Leaking: UNKNOWN
│    Retaining 192.9 kB in 3063 objects
│    mContext instance of com.technicallyfunctional.digitalheartbeat.
│    HeartbeatStatus with mDestroyed = true
│    ↓ LoadedApk$ReceiverDispatcher.mContext
│                                   ~~~~
╰→ com.technicallyfunctional.digitalheartbeat.HeartbeatStatus instance
      Leaking: YES (ObjectWatcher was watching this because com.
      technicallyfunctional.digitalheartbeat.HeartbeatStatus received
      Activity#onDestroy() callback and Activity#mDestroyed is true)
      Retaining 192.0 kB in 3059 objects
      key = d77f13ed-32c8-48e5-9c31-eafeec5fe0a2
      watchDurationMillis = 5614
      retainedDurationMillis = 613
      mApplication instance of android.app.Application
      mBase instance of androidx.appcompat.view.ContextThemeWrapper

METADATA

Build.VERSION.SDK_INT: 31
Build.MANUFACTURER: samsung
LeakCanary version: 2.8
App process name: com.technicallyfunctional.digitalheartbeat
Stats: LruCache[maxSize=3000,hits=109297,misses=193380,hitRate=36%]
RandomAccess[bytes=9669570,reads=193380,travel=64569072020,range=32218197,size=4
0006546]
Analysis duration: 4527 ms

I have a heap dump if it's useful.

Potential fix in 40d18be, closing unless confirmed not fixed