Config
LeakCanary configuration data class. Properties can be updated via copy.
See also
Constructors
Types
Builder for LeakCanary.Config intended to be used only from Java code.
Functions
Construct a new Config via LeakCanary.Config.Builder. Note: this method is intended to be used from Java code only. For idiomatic Kotlin use copy() to modify LeakCanary.config.
Properties
If dumpHeapWhenDebugging is false then LeakCanary will not dump the heap when the debugger is attached. The debugger can create temporary memory leaks (for instance if a thread is blocked on a breakpoint).
Listeners for LeakCanary events. See EventListener.Event for the list of events and which thread they're sent from. You most likely want to keep this list and add to it, or remove a few entries but not all entries. Each listener is independent and provides additional behavior which you can disable by not excluding it:
LeakCanary always attempts to store heap dumps on the external storage if the WRITE_EXTERNAL_STORAGE is already granted, and otherwise uses the app storage. If the WRITE_EXTERNAL_STORAGE permission is not granted and requestWriteExternalStoragePermission is true, then LeakCanary will display a notification to ask for that permission.
When the app is visible, LeakCanary will wait for at least retainedVisibleThreshold retained instances before dumping the heap. Dumping the heap freezes the UI and can be frustrating for developers who are trying to work. This is especially frustrating as the Android Framework has a number of leaks that cannot easily be fixed.
Whether to show LeakCanary notifications. When showNotifications is true, LeakCanary will only display notifications if the app is in foreground and is not an instant, TV or Wear app.