Change Log

!!! info To upgrade from LeakCanary 1.6, follow the upgrade guide.

Version 2.4 (2020-06-10)

Please thank @0x109, @andersu, @antoniomerlin, @bishiboosh, @ckesc, @jrodbx, @LouisCAD, @marcardar, @OlivierGenez, @pyricau, @runningcode, @seljad, @worldsnas for their contributions, bug reports and feature requests.

plumber-android is a new artifact that fixes known Android leaks ๐Ÿšฝ๐Ÿ”ง

LeakCanary reports all leaks, including leaks caused by a known bug in 3rd party code that you do not have control over (reported as Library leaks). That can be annoying! LeakCanary now ships with a new dependency, plumber-android, which performs hacks at runtime to fix some of these known leaks. This releases has fixes for 11 known leaks, but this is just the beginning. Contributions welcome! ๐Ÿ™

Note that since the leakcanary-android dependency is usually added as a debugImplementation dependency, the plumber-android is transitively added only in debug builds, so it will not fix leaks in your release builds. You can add the dependency directly as implementation to get these fixes in release builds as well:

dependencies {
  implementation 'com.squareup.leakcanary:plumber-android:2.4'
}

!!! warning While several of these fixes already ship in release builds of Square apps, this is the first official release of plumber-android, so you should consider it experimental.

Analyzing leaks from the CLI is easier than ever ๐Ÿบ

The Shark CLI can now be installed via Homebrew

brew install leakcanary-shark

You can then look for leaks in apps on any connected device, for example:

$ shark-cli --device emulator-5554 --process com.example.app.debug analyze

Support for Android Test Orchestrator ๐ŸŽผ

If you set up LeakCanary to report test failures when detecting leaks in instrumentation tests, it now works with Android Test Orchestrator as well. No change required, LeakCanary will automatically detect thatAndroid Test Orchestrator is running and hook into it.

No more master branch

The branch name master comes from the master / slave terminology. We renamed the default branch to main, a small step towards making the LeakCanary community a safer space. Here's a good thread on this topic.

Bug fixes and improvements ๐Ÿ›๐Ÿ”จ

  • URLs in Library Leak descriptions are now clickable
  • Fixed ordering issues causing improper config with manual setup. A related change is that [AppWatcher.Config.enabled] is now deprecated.
  • Fixed possible OutOfMemoryError failure when computing retained size: we were loading to memory large arrays from the heap dump just to get their size.

Version 2.3 (2020-04-08)

This is a minor release on the feature front, but a large release on the documentation front!

Many thanks to @adamfit, @Amokrane, @Armaxis, @artnc, @burakeregar, @ClaasJG, @clementcontet, @ckesc, @cketti, @fbenbassat, @Guneetgstar, @Igorxp5, @JLLeitschuh, @KidAndroid, @ligi, @mzgreen, @pyricau, @sprintuu, @tevjef, @thrlr123 for the contributions, bug reports and feature requests.

We asked for help and immediately started seeing more contributions. Thanks all! Check out the How to help page.

LeakCanary will now crash in release builds

Despite the documentation insisting on using debugImplementation, we‘ve seen apps ship LeakCanary in release builds. Mistakes happen, so we’ve made that mistake harder to miss by making LeakCanary crash when included in release builds.

Learn More: LeakCanary in release builds.

Doc site ๐Ÿ›€๐Ÿ’ฅ

The doc site content has changed quite a bit! We applied advice from Google's tech writing guide. If you've been confused by Library Leaks before, check out see the new Categorizing leaks section. Take a look around, let us know what you think.

Bug fixes and improvements ๐Ÿ˜‰

For more details, see the 2.3 Milestone and the full diff.

Version 2.2 (2020-02-05)

We've got some good stuff for the first release of the decade!

Many thanks to @AndroidInternal, @Armaxis, @lic2050, @mzgreen, @orenktaboola, @personshelldon, @Plastix, @pyricau for the contributions, bug reports and feature requests.

ViewModel leak detection

Android ViewModels are really cool! Their lifecycle is much nicer than fragments or activities, but sometimes mistakes happen. LeakCanary will now automatically detect ViewModel leaks and report any ViewModel instance retained after its onCleared() method was called.

Android TV

tv ui

LeakCanary is finally coming to big screens near you! Best part - no additional setup is required, just enable it like you would for a mobile device. Now whenever there's a leak - you will see a helpful Toast appear with all the details. Make sure to check out our new Android TV section and chill!

Java-friendly Config builders

It was brought to our attention that configuring LeakCanary and AppWatcher was a miserable experience from Java code. Well, not anymore!

Now you can use LeakCanary.Config.Builder and AppWatcher.Config.Builder to have idiomatic Java when updating the configurations. For example:

LeakCanary.Config config = LeakCanary.getConfig().newBuilder()
  .retainedVisibleThreshold(3)
  .computeRetainedHeapSize(false)
  .build();
LeakCanary.setConfig(config);

If you notice any other problems when using LeakCanary from Java, please file an issue! We take Java-interop seriously and will be happy to improve LeakCanary's API!

For more details, see the 2.2 Milestone and the full diff.

Version 2.1 (2019-12-31)

A special New Year's Eve release ๐Ÿฅณ, the next release will be in another decade ๐Ÿ˜Ž!

Many thanks to @adamfit, @alexander-smityuk, @Armaxis, @BraisGabin, @devism, @ditclear, @jrodbx, @jstefanowski, @Maragues, @mzgreen, @pyricau for the contributions, bug reports and feature requests.

A Gradle plugin for obfuscated apps

It's fairly common for teams to have a QA build that is tested before making the release build. Usually that build will be obfuscated (via Proguard or R8), but also add LeakCanary to detect leaks during QA. This leads to obfuscated leak traces, which are hard to understand ๐Ÿคฏ. Check out our new Gradle deobfuscation plugin and rejoice!

UI twix tweaks

In 2.0 we changed the LeakCanary UI and UX, and built a foundation on which 2.1 extends.

ui

  • Since 2.0, Leaks are grouped by their distinct signature. In 2.1 there‘s a New tag that will show until you open up a leak. There’s also a Library Leak tag for leaks that are known to be caused by a bug in the Android Framework or Google libraries, and the library leak description now shows up in the UI.
  • The type of the Java objects (class, instance, array) is now displayed in the LeakTrace, e.g. see FontsContract class and ExampleApplication instance above.
  • The type of the GC root now shows up at the root of the leak trace. Makes sense!
  • The leak result notification has an importance now set to MAX so that it‘ll show up right in your face. If you turn it off, the canary will haunt you in your dreams ๐Ÿค๐Ÿ‘ป. To save your sanity and your device battery, automatic heap dumps now won’t happen more often than once per minute.
  • The resource id name for View instances is now displayed in the leak trace. You shouldn't look at the implementation.
โ”œโ”€ android.widget.TextView instance
โ”‚    View.mID = R.id.helper_text

Documentation goodies

  • The Fundamentals page was entirely rewritten, split into 3 pages and moved to its own tab. Please read it and provide feedback!
  • At Square, we have been uploading leaks to Bugsnag for 3 years now, so that no leak ever gets missed. Follow this recipe!
  • Did you know you can run LeakCanary in a JVM?

API breaking bettering changes

  • The APIs of the Leak and LeakTrace classes have significantly changed, e.g. all LeakTrace instances with an identical signature are grouped under the same Leak object. Despite these breaking changes, this release version is a minor update. Oh noes, what about semantic versioning ๐Ÿ˜ฑ? Ask Don Quixote.
  • You can now customize the way LeakCanary finds the leaking objects in the heap dump. For example, here‘s the configuration SharkCli uses to find leaks in heap dumps of apps that don’t even have the LeakCanary dependency:
LeakCanary.config = LeakCanary.config.copy(
    leakingObjectFinder = FilteringLeakingObjectFinder(
        AndroidObjectInspectors.appLeakingObjectFilters
    )
)
  • LeakCanary automatically disables itself in tests by detecting that the org.junit.Test is in the classpath. Unfortunately, some apps ship Junit in their app debug classpath (e.g. when using OkHttp MockWebServer). You can now customize which class is used to detect tests:
<resources>
  <string name="leak_canary_test_class_name">assertk.Assert</string>
</resources>

Interactive CLI

Shark CLI was rewritten on top of Clikt:

$ shark-cli
Usage: shark-cli [OPTIONS] COMMAND [ARGS]...

                 ^`.                 .=""=.
 ^_              \  \               / _  _ \
 \ \             {   \             |  d  b  |
 {  \           /     `~~~--__     \   /\   /
 {   \___----~~'              `~~-_/'-=\/=-'\,
  \                         /// a  `~.      \ \
  / /~~~~-, ,__.    ,      ///  __,,,,)      \ |
  \/      \/    `~~~;   ,---~~-_`/ \        / \/
                   /   /            '.    .'
                  '._.'             _|`~~`|_
                                    /|\  /|\

Options:
  -p, --process NAME              Full or partial name of a process, e.g.
                                  "example" would match "com.example.app"
  -d, --device ID                 device/emulator id
  -m, --obfuscation-mapping PATH  path to obfuscation mapping file
  --verbose / --no-verbose        provide additional details as to what
                                  shark-cli is doing
  -h, --hprof FILE                path to a .hprof file
  --help                          Show this message and exit

Commands:
  interactive   Explore a heap dump.
  analyze       Analyze a heap dump.
  dump-process  Dump the heap and pull the hprof file.
  strip-hprof   Replace all primitive arrays from the provided heap dump with
                arrays of zeroes and generate a new "-stripped.hprof" file.

There's a new interactive command which enables exploring the heap dump from the command line:

$ shark-cli -h heapdump.hprof interactive
Enter command [help]:
help

Available commands:
  analyze                   Analyze the heap dump.
  class NAME@ID             Show class with a matching NAME and Object ID.
  instance CLASS_NAME@ID    Show instance with a matching CLASS_NAME and Object
ID.
  array CLASS_NAME@ID       Show array instance with a matching CLASS_NAME and
Object ID.
  ->instance CLASS_NAME@ID  Show path from GC Roots to instance.
  ~>instance CLASS_NAME@ID  Show path from GC Roots to instance, highlighting
suspect references.
  help                      Show this message.
  exit                      Exit this interactive prompt.

We're currently exploring the idea of adding support for SQL queries, feedback welcome!

For more details, see the 2.1 Milestone and the full diff.

Version 2.0 (2019-11-27)

In the past 7 months, LeakCanary went through 3 alphas and 5 betas, encompassing 23 contributors over 493 commits, 35826 insertions and 10156 deletions.

Should I upgrade?

YES! LeakCanary 2 is so much better, it might make you excited when you see a new memory leak. Follow the upgrade guide, you won't regret it!

So, what's changed since 1.6.3?

Everything. The LeakCanary codebase went from ~6000 lines of Java to ~16000 lines of Kotlin, excluding comments & blanks.

!!! question “Isn't Kotlin supposed to drastically reduce the amount of boilerplate code?” Absolutely! And it did. But then, we wrote more code. LeakCanary used to depend on HAHA, a repackaging of perflib, the heap dump parser used by Android Studio. Unfortunately perflib was slow and used too much memory, so LeakCanary now includes its own heap dump parser: Shark. The extra code comes from Shark, but also from having a lot more automated tests, and an improved UI layer.

One major difference: when the app is in foreground, LeakCanary 2 will not trigger on every retained instance. Instead it will wait until the app goes in background or to reach a threashold of 5 retained instances in foreground. The analysis will then find all the leaks at once, and group identical leaks in the results UI. Please read the Fundamentals section to learn more!

Random facts

  • You can customize the Leaks launcher icon and label: learn more here.
  • If you ` press on your main activity launcher icon, you should see a LeakCanary dynamic shortcut. You can then long press that to drop it on your home screen, and the launcher shows that it's the leaks launcher for your app.
  • Out of the box, LeakCanary tracks all fragments flavors: AOSP, Support Library and Android X.
  • From within the leak screen, you can share a leak to stack overflow. You can also share a heap dump, or import and analyze a heap dump from another device.
  • You can run LeakCanary from your computer command line, on any debuggable app even if that app doesn't have LeakCanary: learn more here.
  • The new documentation is fully searchable and includes the API documentation. Try the search bar โคด.
  • A large 160Mb heap dump uses 2Gb memory when opening it in Android Studio, but only 40Mb with Shark.

Changes since 2.0 Beta 5

  • Shark CLI supports multiple connected devices #1642
  • Fixed missing sources from Maven Central #1643
  • Updated notification icon to avoid confusion with Twitter DM notifications, and added icons to bottom navigation bar #1648
  • Automatic leak detection for support library fragments #1611

Many thanks to @AndreasBoehm, @jrodbx, @pyricau for the contributions, bug reports and feature requests.

For more details, see the 2.0 Milestone and the full diff.

Version 2.0 Beta 5 (2019-11-25)

  • Major bugfix: native gc roots were accidentally ignored in Beta 4, as a result some leaks were not found #1634
  • Fixed Lint warning (leak_canary_about_message string triggered multiple substitutions warning) #1630

Many thanks to @DanEdgarTarget, @msfjarvis, @PaulWoitaschek, @pyricau, @ZacSweers for the contributions, bug reports and feature requests.

For more details, see the 2.0-beta-5 Milestone and the full diff.

Version 2.0 Beta 4 (2019-11-18)

  • Improved string rendering for heap analysis results
  • UX redesign #1445
  • Support for pattern matching of native reference leaks #1562
  • Added support for deobfuscation using Proguard mapping files in Shark #1499. This isn't directly supported in LeakCanary yet.
  • Added support for extracting metadata from the heap dump (see the recipe) #1519
  • Improved auto disabling of LeakCanary in Unit and UI tests #1552
  • Several performance improvements when parsing heap dumps
  • Fixed several bugs and crashes
  • Added new known leak patterns

Many thanks to @Armaxis, @BraisGabin, @bric3, @elihart, @fernandospr, @flickator, @gabrysgab, @JorgeDLS, @lannyf77, @msfjarvis, @mzgreen, @ozmium, @PaulWoitaschek, @pyricau, @shelpy, @vRallev, @ZacSweers for the contributions, bug reports and feature requests.

For more details, see the 2.0-beta-4 Milestone and the full diff.

Version 2.0 Beta 3 (2019-08-22)

  • Baseline memory usage for large hprofs divided by 3 and removed memory spikes #1543
  • Fixed crash when LeakCanary is initialized from another process #1529
  • Java local references are deprioritized to look for longer alternative paths #1525
  • Fixed JavaLocalPattern not matching on Lollipop #1524

Many thanks to @Armaxis, @elihart, @emartynov, @hmcgreevy-instil, @pyricau for the contributions, bug reports and feature requests.

For more details, see the 2.0-beta-3 Milestone and the full diff.

Version 2.0 Beta 2 (2019-08-02)

  • Fixed Leak analysis failed: Object id not found in heap dump. #1516
  • 10x speed increase of hprof indexing on large heap dumps #1520

Many thanks to @kolphi, @pyricau, @ZacSweers for the contributions, bug reports and feature requests.

For more details, see the 2.0-beta-2 Milestone and the full diff.

Version 2.0 Beta 1 (2019-07-30)

  • New standalone library! Shark is the heap analyzer that powers LeakCanary 2, and it can run in any Java VM. It comes with a CLI: you can now run shark-cli analyze-process com.example.myapp from your computer.
  • New Heap Explorer directly on device! Open a Heap Analysis in LeakCanary, tap the options menu and select “Heap Explorer”. This is still experimental and not very user friendly, contributions welcome!
  • Large API rewrite to improve usability. If you used the alpha with a customized configuration, there are breaking changes. Of note: LeakSentry became AppWatcher, RefWatcher became ObjectWatcher, AndroidExcludedRefs became AndroidReferenceMatchers, AnalysisResultListener became OnHeapAnalyzedListener, AndroidLeakTraceInspectors became AndroidObjectInspectors.
  • The entire API surface is now documented and the documentation is available on this website: see the LeakCanary API tab at the top.
  • Removed the dependency on Android X. No more configuration issues! #1462
  • Added Proguard rules for LeakCanary and ObjectWatcher. #1500
  • Display LeakCanary version in the About screen. #1448
  • Bug fixes, new reference matchers and object inspectors

Many thanks to @arctouch-carlosottoboni, @jemaystermind, @kushagrakumar27, @pyricau, @snkashis for the contributions, bug reports and feature requests.

For more details, see the 2.0-beta-1 Milestone and the full diff.

Version 2.0 Alpha 3 (2019-07-04)

  • #1401 LeakCanary can now import all hprof files created from prior LeakCanary versions.
  • #1414 New API: RefWatcher.retainedInstances which returns the instances that are currently considered retained.
  • #1419 New APIs: LeakCanary.Config.maxStoredHeapDumps (default 7) and LeakCanary.Config.requestWriteExternalStoragePermission (default false). LeakCanary won't ask for the external storage permission anymore by default.
  • #1338 API change: LeakCanary.Config.exclusionsFactory replaced with LeakCanary.Config.knownReferences (simpler use), LeakCanary.Config.leakInspectors and LeakCanary.Config.labelers merged into LeakCanary.Config.leakTraceInspectors which provides access to the entire leak trace as well as a new graph oriented API that replaces the low level hprof parser API.
  • #1382 LeakCanary now disables automatic heap dumping when running in AndroidX UI tests.
  • #1424 API rename: RefWatcher.hasRetainedReferences => RefWatcher.hasRetainedInstances, RefWatcher.retainedReferenceCount => RefWatcher.retainedInstanceCount, RefWatcher.hasWatchedReferences => RefWatcher.hasWatchedInstances, RefWatcher.removeKeysRetainedBeforeHeapDump => RefWatcher.removeInstancesRetainedBeforeHeapDump, RefWatcher.clearWatchedReferences => RefWatcher.clearWatchedInstances.
  • #1432 #1438 #1440 New “won't fix” leaks and leak trace inspectors
  • #1374 #1364 #1366 #1417 #1399 #1416 #1407 #1427 #1385 Bug and crash fixes

Many thanks to @1step2hell, @afollestad, @ansman, @bjdodson, @BraisGabin, @EBfVince, @jaredsburrows, @pforhan, @pyricau, @tellypresence, @wiyarmir for the contributions, bug reports and feature requests.

For more details, see the 2.0-alpha-3 Milestone and the full diff.

Version 2.0 Alpha 2 (2019-05-21)

  • #1040 Import and analyze hprof files from other devices
  • #1344 Computing retained size
  • #1325 New notification showing current count of retained instances
  • #1079 “Excluded” leaks have been renamed to “Won't fix” leaks to clarify meaning.
  • #1328 New leaks are called out in the UI.
  • #1327 LeakSentry can be enabled / disabled and is automatically disabled in non debuggable builds.
  • #1173 Experimental: now reporting leaks that only go through weak references (previously reported as “no path to instance”)
  • #1339 Readded support for Thread name based exclusions
  • #1312 Fixed bug causing LeakCanary to stop detecting leaks after the app is killed.
  • #1310 #1313 #1314 #1340 #1337 Many API changes
  • #1296 #1293 #1306 #1336 Fixed several crashes.

Many thanks to @forrestbice, @Foso, @Goddchen, @marcosholgado, @orionlee, @pyricau, @satoshun, @ZacSweers for the contributions!

For more details, see the 2.0-alpha-2 Milestone and the full diff.

Version 2.0 Alpha 1 (2019-04-23)

logo

  • New logo, thanks @flickator!
  • Entirely rewritten to 100% Kotlin
  • Multiple leaks detected in one analysis
    • The heap is dumped when the app goes in the background, or when a minimum of 5 leaks is reached in the foreground.
  • Leak grouping
    • Leaks that share similar causes are grouped in the UI.
    • New screens to see the list of groups and each group.
    • Improved leaktrace strings to highlight leak causes.
    • Leaks can be shared to Stack Overflow
  • New library: LeakSentry.
    • Detects when objects are leaking and triggers LeakCanary
    • Can be used independently in production, for instance to report the number of leaking instances on an OutOfMemoryError crash.
  • New heap parser
    • Uses 90% less memory and 6 times faster than the prior heap parser.
    • Runs in the same process as the app on a low priority thread.
    • No more dependency on Perflib and TroveJ. New dependency on Okio.
    • The old parser is still available as leakcanary-android-perflib but will be removed after alpha.
  • Labelers can add any string content to leak elements
  • 0 code setup, just add the one debug dependency.
  • Simpler configuration options
  • Updated from support library to Android X

Many thanks to @BraisGabin, @colinmarsch, @jrodbx, @flickator, @JakeWharton, @pyricau, @WhatsEmo for the contributions!

For more details, see the 2.0-alpha-1 Milestone and the full diff.

Version 1.6.3 (2019-01-10)

  • #1163 Fixed leaks being incorrectly classified as “no leak” due to missed GC Roots.
  • #1153 LeakCanary.isInAnalyzerProcess now correctly returns true in the analyzer process prior to any first leak (could be triggered by starting the leak result activity).
  • #1158 Stopped enabling DisplayLeakActivity when not using DisplayLeakService.
  • #1135 Fixed IndexOutOfBoundsException for leak traces of size 1.
  • #1163 Keep “no leak” heap dumps.

Many thanks to @KMaragh, @pyricau, @SebRut for the code contributions!

For more details, see the 1.6.3 Milestone and the full diff.

Version 1.6.2 (2018-10-16)

  • #1067 Fixed TransactionTooLargeException crash (leak analysis would never complete).
  • #1061 Detection of Fragment view leaks after Fragment#onDestroyView().
  • #1076 Added the FOREGROUND_SERVICE permission for Android P.
  • #1062 The LeakCanary toast now always shows correctly. It doesn't show if there is no activity in foreground.
  • #1115 Reenabled the DisplayLeakActivity icon on fresh installs.
  • #1100 Added nullability annotations to improve Kotlin support.
  • Updates to excluded leaks (commits).
  • Updates to reachability inspectors (commits).

Many thanks to @fractalwrench, @ZacSweers, @Goddchen, @igokoro, @IlyaGulya, @JakeWharton, @javmarina, @jokermonn, @jrodbx, @Parseus, @pyricau, @scottkennedy for the code contributions!

Public API changes

  • Subclasses of AbstractAnalysisResultService should now override onHeapAnalyzed(@NonNull AnalyzedHeap analyzedHeap) instead of onHeapAnalyzed(@NonNull HeapDump heapDump, @NonNull AnalysisResult result)

For more details, see the 1.6.2 Milestone and the full diff.

Version 1.6.1 (2018-06-21)

  • #727 Improved leak analysis: LeakCanary now identifies and highlights the potential causes of the leak.
  • #1011 We noticed that computing the retained heap size could take a long time, so it's now optional and off by default.
  • #633 Support for detecting leaks in instrumentation tests (see the wiki).
  • #985 Ability to convert leak traces into stack traces for easy remote reporting (see the wiki).
  • #983 Support for watching destroyed Fragments.
  • #846 LeakCanary now uses foreground services and displays a notification when the analysis is in progress. This also fixes crashes when analyzing in background on O+.
  • The LeakCanary icon (to start to DisplayLeakActivity) is now hidden by default, and only enabled after the first leak is found.
  • #775 Fixed crash when sharing heap dumps on O+ and added a dependency to the support-core-utils library.
  • #930 DisplayLeakActivity has a responsive icon.
  • #685 Stopped doing IO on main thread in DisplayLeakActivity (fixes StrictMode errors).
  • #999 Updated HAHA to 2.0.4, which uses Trove4j as an external dependency (from jcenter) instead of rebundling it. This is to clarify licences (Apache v2 vs LGPL 2.1).
  • Several bug and crash fixes.

Many thanks to @AdityaAnand1, @alhah, @christxph, @csoon03, @daqi, @JakeWharton, @jankovd, @jrodbx, @kurtisnelson, @NightlyNexus, @pyricau, @SalvatoreT, @shmuelr, @tokou, @xueqiushi for the code contributions!

Note: we made a 1.6 release but quickly followed up with 1.6.1 due to #1058.

Public API changes

  • The installed ref watcher singleton is now available via LeakCanary.installedRefWatcher()
  • AnalysisResult.leakTraceAsFakeException() returns an exception that can be used to report and group leak traces to a tool like Bugsnag or Crashlytics.
  • New InstrumentationLeakDetector and FailTestOnLeakRunListener APIs for detecting leaks in instrumentation tests.
  • New Reachability.Inspector and RefWatcherBuilder.stethoscopeClasses() API to establish reachability and help identify leak causes.
  • Watching activities can be disabled with AndroidRefWatcherBuilder.watchActivities(false), watching fragments can be disabled with AndroidRefWatcherBuilder.watchFragments(false)
  • LeakCanary.setDisplayLeakActivityDirectoryProvider() is deprecated and replaced with LeakCanary.setLeakDirectoryProvider()
  • New RefWatcherBuilder.computeRetainedHeapSize() API to enable the computing of the retained heap size (off by default).

For more details, see the 1.6.1 Milestone and the full diff.

Version 1.5.4 (2017-09-22)

  • Restore Java 7 compatibility in leakcanary-watcher

Version 1.5.3 (2017-09-17)

  • Fix broken 1.5.2 build
  • Convert leakcanary-watcher from Android library to Java library
  • Disable finish animations in RequestStoragePermissionActivity
  • Corrected README sample for Robolectric tests

For more details, see the full diff.

Version 1.5.2 (2017-08-09)

  • New excluded leaks
  • Move Leakcanary UI into leak analyzer process
  • Ignore computing retained sizes for bitmaps on O+
  • Add notification channel for persistent messages on O+
  • Exclude permission activity from recents menu
  • Updated README and sample for handling Robolectric tests

For more details, see the full diff.

Version 1.5.1 (2017-04-25)

  • New excluded leaks
  • Fix java.util.MissingFormatArgumentException in DisplayLeakService
  • Separate task affinities for different apps
  • Bump minSdk to 14
  • Fix HahaHelper for O Preview

For more details, see the full diff.

Version 1.5 (2016-09-28)

  • New excluded leaks
  • Added LeakCanary.isInAnalyzerProcess() to the no-op jar
  • Fixed several file access issues:
    • No more cleanup on startup, we rotate the heap dump files on every new heap dump.
    • LeakCanary now falls back to the app directory until it can write to the external storage.
  • Leak notifications now each use a distinct notification instead of erasing each other.
  • If LeakCanary can't perform a heap dump for any reason (e.g. analysis in progress, debugger attached), it retries later with an exponential backoff.
  • Added confirmation dialog when user deletes all leaks.
  • Replace the two LeakCanary configuration methods with a builder that provides more flexibility, see LeakCanary.refWatcher().

For more details, see the full diff.

Public API changes

  • New HeapAnalyzer.findTrackedReferences() method for headless analysis when you have no context on what leaked.
  • Added LeakCanary.isInAnalyzerProcess() to the no-op jar
  • Added LeakCanary.refWatcher() which returns an AndroidRefWatcherBuilder that extends RefWatcherBuilder and lets you fully customize the RefWatcher instance.
  • Removed LeakCanary.install(Application, Class) and LeakCanary.androidWatcher(Context, HeapDump.Listener, ExcludedRefs).
  • Removed R.integer.leak_canary_max_stored_leaks and R.integer.leak_canary_watch_delay_millis, those can now be set via LeakCanary.refWatcher().
  • Updated the LeakDirectoryProvider API to centralize all file related responsibilities.
  • RefWatcher is now constructed with a WatchExecutor which executes a Retryable, instead of an Executor that executes a Runnable.
  • HeapDumper.NO_DUMP was renamed HeapDumper.RETRY_LATER

Version 1.4 (2016-09-11)

  • Fix false negative where GC root is of type android.os.Binder #482
  • Update HAHA to 2.0.3; clear compiler warnings #563
  • Correct some mistakes in German translation #516
  • Don't loop when storage permission denied #422
  • Remove old references to “__” prefixed resources #477
  • Fix permission crash for DisplayLeakActivity on M #382
  • Fix NPE when thread name not found in heap dump #417
  • Add version info to stacktrace #473

Version 1.4-beta2 (2016-03-23)

  • Add reason for ignoring to analysis result #365.
  • Lower memory usage when parsing heap dumps on M #223.
  • Fix NPE in LeakCanaryInternals.isInServiceProcess() #449.
  • New ignored Android SDK leaks #297,#322.
  • Use leakcanary-android-no-op in test builds #143.
  • Fixes to allow LeakCanary to work with ProGuard #398.
  • Optimize png assets #406.
  • Fix delete button not working on error views #408.
  • Add German translation #437.

Version 1.4-beta1 (2016-01-08)

  • Switched to HAHA 2.0.2 with uses Perflib instead of MAT under the hood #219. This fixes crashes and improves speed a lot.
  • We can now parse Android M heap dumps #267, although there are still memory issues (see #223).
  • Excluded leaks are now reported as well and available in the display leak activity.
  • Added ProGuard configuration for #132.
  • Many new ignored Android SDK leaks.
  • Added excluded leaks to text report #119.
  • Added LeakCanary SHA to text report #120.
  • Added CanaryLog API to replace the logger: #201.
  • Renamed all resources to begin with leak_canary_ instead of __leak_canary#161
  • No crash when heap dump fails #226.
  • Add retained size to leak reports #162.

Public API changes

  • AnalysisResult.failure is now a Throwable instead of an Exception. Main goal is to catch and correctly report OOMs while parsing.
  • Added ARRAY_ENTRY to LeakTraceElement.Type for references through array entries.
  • Renamed ExcludedRefs fields.
  • Each ExcludedRef entry can now be ignored entirely or “kept only if no other path”.
  • Added support for ignoring all fields (static and non static) for a given class.

Version 1.3.1 (2015-05-16)

  • Heap dumps and analysis results are now saved on the sd card: #21.
  • ExcludedRef and AndroidExcludedRefs are customizable: #12 #73.
  • 7 new ignored Android SDK leaks: #1 #4 #32 #89 #82 #97.
  • Fixed 3 crashes in LeakCanary: #37 #46 #66.
  • Fixed StrictMode thread policy violations: #15.
  • Updated minSdkVersion from 9 to 8: #57.
  • Added LeakCanary version name to LeakCanary.leakInfo(): #49.
  • leakcanary-android-no-op is lighter, it does not depend on leakcanary-watcher anymore, only 2 classes now: #74.
  • Adding field state details to the text leak trace.
  • A Toast is displayed while the heap dump is in progress to warn that the UI will freeze: #20. You can customize the toast by providing your own layout named __leak_canary_heap_dump_toast.xml (e.g. you could make it an empty layout).
  • If the analysis fails, the result and heap dump are kept so that it can be reported to LeakCanary: #102.
  • Update to HAHA 1.3 to fix a 2 crashes #3 46

Public API changes

  • When upgrading from 1.3 to 1.3.1, previously saved heap dumps will not be readable any more, but they won't be removed from the app directory. You should probably uninstall your app.
  • Added android.permission.WRITE_EXTERNAL_STORAGE to leakcanary-android artifact.
  • LeakCanary.androidWatcher() parameter types have changed (+ExcludedRefs).
  • LeakCanary.leakInfo() parameter types have changed (+boolean)
  • ExcludedRef is now serializable and immutable, instances can be created using ExcludedRef.Builder.
  • ExcludedRef is available in HeapDump
  • AndroidExcludedRefs is an enum, you can now pick the leaks you want to ignore in AndroidExcludedRefs by creating an EnumSet and calling AndroidExcludedRefs.createBuilder().
  • AndroidExcludedRefs.createAppDefaults() & AndroidExcludedRefs.createAndroidDefaults() return a ExcludedRef.Builder.
  • ExcludedRef moved from leakcanary-analyzer to leakcanary-watcher

Version 1.3 (2015-05-08)

Initial release.

Dependencies