Infinity-For-Lemmy/app
Michael Manganiello 9fad6fc961
Fix memory leak on ConnectivityManager (#1066)
Leak found using LeakCanary. Steps:
1. Enable the LeakCanary dependency.
1. Open the app.
1. Go to the "All" tab.
1. Open any post, and go back to the post list.

Leak trace:

```
2022-09-04 17:56:05.904 32018-32018/ml.docilealligator.infinityforreddit.debug D/LeakCanary:
    ┬───
    │ GC Root: System class
    │
    ├─ android.net.ConnectivityManager class
    │    Leaking: NO (a class is never leaking)
    │    ↓ static ConnectivityManager.sInstance
    │                                 ~~~~~~~~~
    ├─ android.net.ConnectivityManager instance
    │    Leaking: UNKNOWN
    │    Retaining 114 B in 5 objects
    │    mContext instance of ml.docilealligator.infinityforreddit.activities.ViewPostDetailActivity with mDestroyed = true
    │    ↓ ConnectivityManager.mContext
    │                          ~~~~~~~~
    ╰→ ml.docilealligator.infinityforreddit.activities.ViewPostDetailActivity instance
         Leaking: YES (ObjectWatcher was watching this because ml.docilealligator.infinityforreddit.activities.
         ViewPostDetailActivity received Activity#onDestroy() callback and Activity#mDestroyed is true)
         Retaining 1.8 MB in 27752 objects
         key = 22e99901-9689-4f70-b88c-092a4a7efad9
         watchDurationMillis = 5518
         retainedDurationMillis = 517
         mApplication instance of ml.docilealligator.infinityforreddit.Infinity
         mBase instance of androidx.appcompat.view.ContextThemeWrapper
```

Solution based on [this StackOverflow answer](https://stackoverflow.com/a/41431693)
2022-09-21 12:47:38 +08:00
..
src/main Fix memory leak on ConnectivityManager (#1066) 2022-09-21 12:47:38 +08:00
build.gradle Start utilizing view binding (#1013) 2022-09-21 12:46:13 +08:00
proguard-rules.pro keep class CrashReportsFragment 2021-11-03 05:45:53 +07:00