Skip to content

Commit

Permalink
Prepare 2.0 Beta 1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
pyricau committed Jul 30, 2019
1 parent aef1d5b commit 5021bc8
Show file tree
Hide file tree
Showing 772 changed files with 8,327 additions and 2 deletions.
9 changes: 9 additions & 0 deletions docs/api/leakcanary-android-core/alltypes/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@


### All Types

| Name | Summary |
|---|---|
| [leakcanary.DefaultOnHeapAnalyzedListener](../leakcanary/-default-on-heap-analyzed-listener/index.md) | Default [OnHeapAnalyzedListener](../leakcanary/-on-heap-analyzed-listener/index.md) implementation, which will store the analysis to disk and show a notification summarizing the result. |
| [leakcanary.LeakCanary](../leakcanary/-leak-canary/index.md) | The entry point API for LeakCanary. LeakCanary builds on top of [AppWatcher](#). AppWatcher notifies LeakCanary of retained instances, which in turns dumps the heap, analyses it and publishes the results. |
| [leakcanary.OnHeapAnalyzedListener](../leakcanary/-on-heap-analyzed-listener/index.md) | Listener set in [LeakCanary.Config](../leakcanary/-leak-canary/-config/index.md) and called by LeakCanary on a background thread when the heap analysis is complete. |
11 changes: 11 additions & 0 deletions docs/api/leakcanary-android-core/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[leakcanary-android-core](./index.md)

### Packages

| Name | Summary |
|---|---|
| [leakcanary](leakcanary/index.md) | |

### Index

[All Types](alltypes/index.md)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[leakcanary-android-core](../../index.md) / [leakcanary](../index.md) / [DefaultOnHeapAnalyzedListener](index.md) / [<init>](./-init-.md)

# <init>

`DefaultOnHeapAnalyzedListener(application: Application)`

Default [OnHeapAnalyzedListener](../-on-heap-analyzed-listener/index.md) implementation, which will store the analysis to disk and
show a notification summarizing the result.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[leakcanary-android-core](../../index.md) / [leakcanary](../index.md) / [DefaultOnHeapAnalyzedListener](index.md) / [create](./create.md)

# create

`fun create(): `[`OnHeapAnalyzedListener`](../-on-heap-analyzed-listener/index.md)
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[leakcanary-android-core](../../index.md) / [leakcanary](../index.md) / [DefaultOnHeapAnalyzedListener](./index.md)

# DefaultOnHeapAnalyzedListener

`class DefaultOnHeapAnalyzedListener : `[`OnHeapAnalyzedListener`](../-on-heap-analyzed-listener/index.md)

Default [OnHeapAnalyzedListener](../-on-heap-analyzed-listener/index.md) implementation, which will store the analysis to disk and
show a notification summarizing the result.

### Constructors

| Name | Summary |
|---|---|
| [&lt;init&gt;](-init-.md) | `DefaultOnHeapAnalyzedListener(application: Application)`<br>Default [OnHeapAnalyzedListener](../-on-heap-analyzed-listener/index.md) implementation, which will store the analysis to disk and show a notification summarizing the result. |

### Functions

| Name | Summary |
|---|---|
| [onHeapAnalyzed](on-heap-analyzed.md) | `fun onHeapAnalyzed(heapAnalysis: HeapAnalysis): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) |

### Companion Object Functions

| Name | Summary |
|---|---|
| [create](create.md) | `fun create(): `[`OnHeapAnalyzedListener`](../-on-heap-analyzed-listener/index.md) |
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[leakcanary-android-core](../../index.md) / [leakcanary](../index.md) / [DefaultOnHeapAnalyzedListener](index.md) / [onHeapAnalyzed](./on-heap-analyzed.md)

# onHeapAnalyzed

`fun onHeapAnalyzed(heapAnalysis: HeapAnalysis): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)

Overrides [OnHeapAnalyzedListener.onHeapAnalyzed](../-on-heap-analyzed-listener/on-heap-analyzed.md)

**See Also**

[OnHeapAnalyzedListener](../-on-heap-analyzed-listener/index.md)

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[leakcanary-android-core](../../../index.md) / [leakcanary](../../index.md) / [LeakCanary](../index.md) / [Config](index.md) / [&lt;init&gt;](./-init-.md)

# &lt;init&gt;

`Config(dumpHeap: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` = true, dumpHeapWhenDebugging: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` = false, retainedVisibleThreshold: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` = 5, referenceMatchers: `[`List`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)`<ReferenceMatcher> = AndroidReferenceMatchers.appDefaults, objectInspectors: `[`List`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)`<ObjectInspector> = AndroidObjectInspectors.appDefaults, onHeapAnalyzedListener: `[`OnHeapAnalyzedListener`](../../-on-heap-analyzed-listener/index.md)` = DefaultOnHeapAnalyzedListener.create(), computeRetainedHeapSize: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` = true, maxStoredHeapDumps: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` = 7, requestWriteExternalStoragePermission: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` = false, useExperimentalLeakFinders: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` = false)`

LeakCanary configuration data class. Properties can be updated via [copy](#).

**See Also**

[config](../config.md)

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[leakcanary-android-core](../../../index.md) / [leakcanary](../../index.md) / [LeakCanary](../index.md) / [Config](index.md) / [computeRetainedHeapSize](./compute-retained-heap-size.md)

# computeRetainedHeapSize

`val computeRetainedHeapSize: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)

Whether to compute the retained heap size, which is the total number of bytes in memory that
would be reclaimed if the detected leaks didn't happen. This includes native memory
associated to Java objects (e.g. Android bitmaps).

Computing the retained heap size can slow down the analysis because it requires navigating
from GC roots through the entire object graph, whereas [shark.HeapAnalyzer](#) would otherwise
stop as soon as all leaking instances are found.

Defaults to true.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[leakcanary-android-core](../../../index.md) / [leakcanary](../../index.md) / [LeakCanary](../index.md) / [Config](index.md) / [dumpHeapWhenDebugging](./dump-heap-when-debugging.md)

# dumpHeapWhenDebugging

`val dumpHeapWhenDebugging: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)

If [dumpHeapWhenDebugging](./dump-heap-when-debugging.md) 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).

Defaults to false.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[leakcanary-android-core](../../../index.md) / [leakcanary](../../index.md) / [LeakCanary](../index.md) / [Config](index.md) / [dumpHeap](./dump-heap.md)

# dumpHeap

`val dumpHeap: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)

Whether LeakCanary should dump the heap when enough retained instances are found. This needs
to be true for LeakCanary to work, but sometimes you may want to temporarily disable
LeakCanary (e.g. for a product demo).

Defaults to true.

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[leakcanary-android-core](../../../index.md) / [leakcanary](../../index.md) / [LeakCanary](../index.md) / [Config](./index.md)

# Config

`data class Config`

LeakCanary configuration data class. Properties can be updated via [copy](#).

**See Also**

[config](../config.md)

### Constructors

| Name | Summary |
|---|---|
| [&lt;init&gt;](-init-.md) | `Config(dumpHeap: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` = true, dumpHeapWhenDebugging: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` = false, retainedVisibleThreshold: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` = 5, referenceMatchers: `[`List`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)`<ReferenceMatcher> = AndroidReferenceMatchers.appDefaults, objectInspectors: `[`List`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)`<ObjectInspector> = AndroidObjectInspectors.appDefaults, onHeapAnalyzedListener: `[`OnHeapAnalyzedListener`](../../-on-heap-analyzed-listener/index.md)` = DefaultOnHeapAnalyzedListener.create(), computeRetainedHeapSize: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` = true, maxStoredHeapDumps: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` = 7, requestWriteExternalStoragePermission: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` = false, useExperimentalLeakFinders: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` = false)`<br>LeakCanary configuration data class. Properties can be updated via [copy](#). |

### Properties

| Name | Summary |
|---|---|
| [computeRetainedHeapSize](compute-retained-heap-size.md) | `val computeRetainedHeapSize: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)<br>Whether to compute the retained heap size, which is the total number of bytes in memory that would be reclaimed if the detected leaks didn't happen. This includes native memory associated to Java objects (e.g. Android bitmaps). |
| [dumpHeap](dump-heap.md) | `val dumpHeap: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)<br>Whether LeakCanary should dump the heap when enough retained instances are found. This needs to be true for LeakCanary to work, but sometimes you may want to temporarily disable LeakCanary (e.g. for a product demo). |
| [dumpHeapWhenDebugging](dump-heap-when-debugging.md) | `val dumpHeapWhenDebugging: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)<br>If [dumpHeapWhenDebugging](dump-heap-when-debugging.md) 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). |
| [maxStoredHeapDumps](max-stored-heap-dumps.md) | `val maxStoredHeapDumps: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)<br>How many heap dumps are kept on the Android device for this app package. When this threshold is reached LeakCanary deletes the older heap dumps. As several heap dumps may be enqueued you should avoid going down to 1 or 2. |
| [objectInspectors](object-inspectors.md) | `val objectInspectors: `[`List`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)`<ObjectInspector>`<br>List of [ObjectInspector](#) that provide LeakCanary with insights about objects found in the heap. You can create your own [ObjectInspector](#) implementations, and also add a [shark.AppSingletonInspector](#) instance created with the list of internal singletons. |
| [onHeapAnalyzedListener](on-heap-analyzed-listener.md) | `val onHeapAnalyzedListener: `[`OnHeapAnalyzedListener`](../../-on-heap-analyzed-listener/index.md)<br>Called on a background thread when the heap analysis is complete. If you want leaks to be added to the activity that lists leaks, make sure to delegate calls to a [DefaultOnHeapAnalyzedListener](../../-default-on-heap-analyzed-listener/index.md). |
| [referenceMatchers](reference-matchers.md) | `val referenceMatchers: `[`List`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)`<ReferenceMatcher>`<br>Known patterns of references in the heap, lister here either to ignore them ([IgnoredReferenceMatcher](#)) or to mark them as library leaks ([LibraryLeakReferenceMatcher](#)). |
| [requestWriteExternalStoragePermission](request-write-external-storage-permission.md) | `val requestWriteExternalStoragePermission: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)<br>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](request-write-external-storage-permission.md) is true, then LeakCanary will display a notification to ask for that permission. |
| [retainedVisibleThreshold](retained-visible-threshold.md) | `val retainedVisibleThreshold: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)<br>When the app is visible, LeakCanary will wait for at least [retainedVisibleThreshold](retained-visible-threshold.md) 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. |
| [useExperimentalLeakFinders](use-experimental-leak-finders.md) | `val useExperimentalLeakFinders: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)<br>When true, [objectInspectors](object-inspectors.md) are used to find leaks instead of only checking instances tracked by [KeyedWeakReference](#). This leads to finding more leaks and shorter leak traces. However this also means the same leaking instances will be found in every heap dump for a given process life. |
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[leakcanary-android-core](../../../index.md) / [leakcanary](../../index.md) / [LeakCanary](../index.md) / [Config](index.md) / [maxStoredHeapDumps](./max-stored-heap-dumps.md)

# maxStoredHeapDumps

`val maxStoredHeapDumps: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)

How many heap dumps are kept on the Android device for this app package. When this threshold
is reached LeakCanary deletes the older heap dumps. As several heap dumps may be enqueued
you should avoid going down to 1 or 2.

Defaults to 7.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[leakcanary-android-core](../../../index.md) / [leakcanary](../../index.md) / [LeakCanary](../index.md) / [Config](index.md) / [objectInspectors](./object-inspectors.md)

# objectInspectors

`val objectInspectors: `[`List`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)`<ObjectInspector>`

List of [ObjectInspector](#) that provide LeakCanary with insights about objects found in the
heap. You can create your own [ObjectInspector](#) implementations, and also add
a [shark.AppSingletonInspector](#) instance created with the list of internal singletons.

Defaults to [AndroidObjectInspectors.appDefaults](#)

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[leakcanary-android-core](../../../index.md) / [leakcanary](../../index.md) / [LeakCanary](../index.md) / [Config](index.md) / [onHeapAnalyzedListener](./on-heap-analyzed-listener.md)

# onHeapAnalyzedListener

`val onHeapAnalyzedListener: `[`OnHeapAnalyzedListener`](../../-on-heap-analyzed-listener/index.md)

Called on a background thread when the heap analysis is complete.
If you want leaks to be added to the activity that lists leaks, make sure to delegate
calls to a [DefaultOnHeapAnalyzedListener](../../-default-on-heap-analyzed-listener/index.md).

Defaults to [DefaultOnHeapAnalyzedListener](../../-default-on-heap-analyzed-listener/index.md)

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[leakcanary-android-core](../../../index.md) / [leakcanary](../../index.md) / [LeakCanary](../index.md) / [Config](index.md) / [referenceMatchers](./reference-matchers.md)

# referenceMatchers

`val referenceMatchers: `[`List`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)`<ReferenceMatcher>`

Known patterns of references in the heap, lister here either to ignore them
([IgnoredReferenceMatcher](#)) or to mark them as library leaks ([LibraryLeakReferenceMatcher](#)).

When adding your own custom [LibraryLeakReferenceMatcher](#) instances, you'll most
likely want to set [LibraryLeakReferenceMatcher.patternApplies](#) with a filter that checks
for the Android OS version and manufacturer. The build information can be obtained by calling
[shark.AndroidBuildMirror.fromHeapGraph](#).

Defaults to [AndroidReferenceMatchers.appDefaults](#)

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[leakcanary-android-core](../../../index.md) / [leakcanary](../../index.md) / [LeakCanary](../index.md) / [Config](index.md) / [requestWriteExternalStoragePermission](./request-write-external-storage-permission.md)

# requestWriteExternalStoragePermission

`val requestWriteExternalStoragePermission: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)

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](./request-write-external-storage-permission.md) is true, then LeakCanary will display a notification
to ask for that permission.

Defaults to false because that permission notification can be annoying.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[leakcanary-android-core](../../../index.md) / [leakcanary](../../index.md) / [LeakCanary](../index.md) / [Config](index.md) / [retainedVisibleThreshold](./retained-visible-threshold.md)

# retainedVisibleThreshold

`val retainedVisibleThreshold: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)

When the app is visible, LeakCanary will wait for at least
[retainedVisibleThreshold](./retained-visible-threshold.md) 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.

When the app becomes invisible, LeakCanary dumps the heap after
[AppWatcher.Config.watchDurationMillis](#) ms.

The app is considered visible if it has at least one activity in started state.

A higher threshold means LeakCanary will dump the heap less often, therefore it won't be
bothering developers as much but it could miss some leaks.

Defaults to 5.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[leakcanary-android-core](../../../index.md) / [leakcanary](../../index.md) / [LeakCanary](../index.md) / [Config](index.md) / [useExperimentalLeakFinders](./use-experimental-leak-finders.md)

# useExperimentalLeakFinders

`val useExperimentalLeakFinders: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)

When true, [objectInspectors](object-inspectors.md) are used to find leaks instead of only checking instances
tracked by [KeyedWeakReference](#). This leads to finding more leaks and shorter leak traces.
However this also means the same leaking instances will be found in every heap dump for a
given process life.

Defaults to false.

13 changes: 13 additions & 0 deletions docs/api/leakcanary-android-core/leakcanary/-leak-canary/config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[leakcanary-android-core](../../index.md) / [leakcanary](../index.md) / [LeakCanary](index.md) / [config](./config.md)

# config

`var config: `[`LeakCanary.Config`](-config/index.md)

The current LeakCanary configuration. Can be updated at any time, usually by replacing it with
a mutated copy, e.g.:

```
LeakCanary.config = LeakCanary.config.copy(computeRetainedHeapSize = true)
```

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[leakcanary-android-core](../../index.md) / [leakcanary](../index.md) / [LeakCanary](index.md) / [dumpHeap](./dump-heap.md)

# dumpHeap

`fun dumpHeap(): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)

Immediately triggers a heap dump and analysis, if there is at least one retained instance
tracked by [AppWatcher.objectWatcher](#). If there are no retained instances then the heap will not
be dumped and a notification will be shown instead.

0 comments on commit 5021bc8

Please sign in to comment.