Files
flipper/docs/leak-canary-plugin.md
Pascal Hartig 632628e630 Update name references in java docs
Summary: Per title. Tried to only update the things I touched myself.

Reviewed By: jknoxville

Differential Revision: D10028023

fbshipit-source-id: 09b56ea9d19caa277a107e4ea970d3ebb28b2165
2018-09-25 08:58:15 -07:00

1.1 KiB

id, title
id title
leak-canary-plugin LeakCanary

The LeakCanary plugin provides developers with Flipper support for LeakCanary, an open source memory leak detection library.

Setup

Note: this plugin is only available for Android.

Android

First, add the plugin to your Flipper client instance:

import com.facebook.flipper.plugins.leakcanary.LeakCanaryFlipperPlugin;

client.addPlugin(new LeakCanaryFlipperPlugin());

Next, build a custom RefWatcher using RecordLeakService: (see LeakCanary docs for more information on RefWatcher)

import com.facebook.flipper.plugins.leakcanary.RecordLeakService;

RefWatcher refWatcher = LeakCanary.refWatcher(this)
    .listenerServiceClass(RecordLeakService.class);
    .buildAndInstall();

Usage

Leaks detected by LeakCanary will appear automatically in Flipper. Each leak will display a hierarchy of objects, beginning from the garbage collector root and ending at the leaked class. Selecting any object in this list will display contents of the object's various fields.