Skip to content

Commit

Permalink
Update LeakCanary library
Browse files Browse the repository at this point in the history
  • Loading branch information
TacoTheDank committed May 30, 2023
1 parent 1925687 commit 6775f20
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ ext {
groupieVersion = '2.10.1'
markwonVersion = '4.6.2'

leakCanaryVersion = '2.9.1'
leakCanaryVersion = '2.11'
stethoVersion = '1.6.0'
mockitoVersion = '4.0.0'
assertJVersion = '3.23.1'
Expand Down Expand Up @@ -291,7 +291,7 @@ dependencies {
// Memory leak detection
implementation "com.squareup.leakcanary:leakcanary-object-watcher-android:${leakCanaryVersion}"
implementation "com.squareup.leakcanary:plumber-android:${leakCanaryVersion}"
debugImplementation "com.squareup.leakcanary:leakcanary-android:${leakCanaryVersion}"
debugImplementation "com.squareup.leakcanary:leakcanary-android-core:${leakCanaryVersion}"
// Debug bridge for Android
debugImplementation "com.facebook.stetho:stetho:${stethoVersion}"
debugImplementation "com.facebook.stetho:stetho-okhttp3:${stethoVersion}"
Expand Down
2 changes: 1 addition & 1 deletion app/src/debug/java/org/schabi/newpipe/DebugApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class DebugApp : App() {
initStetho()

// Give each object 10 seconds to be GC'ed, before LeakCanary gets nosy on it
AppWatcher.config = AppWatcher.config.copy(watchDurationMillis = 10000)
AppWatcher.manualInstall(this, retainedDelayMillis = 10000)
LeakCanary.config = LeakCanary.config.copy(
dumpHeap = PreferenceManager
.getDefaultSharedPreferences(this).getBoolean(
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/org/schabi/newpipe/BaseFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ protected void onRestoreInstanceState(@NonNull final Bundle savedInstanceState)
public void onDestroy() {
super.onDestroy();

AppWatcher.INSTANCE.getObjectWatcher().watch(this);
AppWatcher.INSTANCE.getObjectWatcher().expectWeaklyReachable(
this, "Watch for leaks from destroyed fragments.");
}

/*//////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 6775f20

Please sign in to comment.