Skip to content
李锐 edited this page Aug 10, 2020 · 5 revisions

KOOM is a OOM killer on moblile platform by Kwai.

It is a fast, reliable, easy-to-use mobile online memory monitoring solution,and has solved a large number of OOM issues in the Kwai application. It's currently available on Android.

KOOM for Android

Features

  • Fast. KOOM blocks the application less than 100ms by forking child process to dump hprof, it also has an efficient leak detect module and a fast hprof analysis module.
  • Reliable. KOOM's performance and stability have withstood the test of hundreds of millions of number of users and devices.
  • Easy-to-use. You just need to init KOOM, and it will take care of other things for you.

Getting started

Gradle dependencies

dependencies {
    implementation 'com.kwai.koom:java-oom:1.0.3'
}

Quick Tutorial

You can setup KOOM as soon as you want to start memory monitoring, to setup on App startup, you can do like this:

public class KOOMApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        KOOM.init(this);
    }

}

Java-oom Heap Report

When the java heap is over the threshold by heap monitor, the heap dump and heap analysis is triggered then.

A java-oom heap report will be generated when heap analysis done.

Find a time to get the report manually.

public void getReportManually() {
    File reportDir = new File(KOOM.getInstance().getReportDir());
    for (File report : reportDir.listFiles()) {
        // Upload the report or do something else.
    }
}

Or set a listener to listen and get the report file status.

public void listenReportGenerateStatus() {
    KOOM.getInstance().setHeapReportUploader(file -> {
        // Upload the report or do something else.
        // File is deleted automatically when callback is done by default.
    });
}

License

KOOM is under the Apache license 2.0. For details check out the LICENSE.

Change Log

Check out the CHANGELOG.md for details of change history.

Contributing

If you are interested in contributing, check out the CONTRIBUTING.md

FAQ & Feedback

Welcome report issues or contact us.

Clone this wiki locally