Investigates Android memory leaks, OOMs, and memory waste by analyzing LeakCanary traces, heap dumps, dumpsys meminfo, and code reviews. Covers Activities, Fragments, ViewBinding, Compose, coroutines, RxJava, Dagger/Hilt, and Koin scoping issues.
Ships in android-performance. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Two tasks. Pick one first.
| The user gives you | Task |
|---|---|
A LeakCanary trace, heap dump, OOM stack, dumpsys meminfo, "memory keeps growing" | A. Investigate |
| Source files, a diff or PR, "review this for leaks", "is this safe to hold here" | B. Review |
| Both | A, then B on the classes in the leak trace |
If unclear, ask: "Do you want me to explain a specific leak, or review code for leaks?"
Read a reference only when a step sends you there. Each one has a table of contents.
- [ ] 1. Identify the evidence type
- [ ] 2. Find the leaking object and the reference that should not exist
- [ ] 3. Match to a pattern
- [ ] 4. Fix at the owner of the reference
- [ ] 5. Verify the leak is gone
scripts/capture_heap_dump.sh <package> instead of reading it.Leaking: NO and
the first marked Leaking: YES. The reference between them (underlined with ~~~) is the
one to break. See references/leak-trace-reading.md.WeakReference unless the
reference is genuinely optional.dumpsys meminfo drops back.Write the result with templates/leak-report.md.
| Leak trace shows | Pattern | Read |
|---|---|---|
Fragment.mView or a *Binding field after onDestroyView | View outliving its Fragment | lifecycle-and-views.md |
A singleton, companion object, or static field holding an Activity, View, or Context | Context and statics | context-and-statics.md |
A manager, SDK, NavController, Choreographer, ProcessLifecycleOwner holding a listener or lambda | Listener not removed | listeners-and-callbacks.md |
MessageQueue → Message → Handler/Runnable | Delayed message | listeners-and-callbacks.md |
A coroutine Job, StandaloneCoroutine, Rx Disposable, SharedFlow replay cache, or a Thread | Async work outliving its owner | async-and-scopes.md |
| A DI component or scoped object holding an Activity, Presenter, or View | DI scope mismatch | di-scopes.md |
ViewModel holding a View, Activity, Binding, or composable lambda | ViewModel holding UI | lifecycle-and-views.md |
| Native memory, Bitmaps, WebView, cursors, file handles | Resources | resources-and-native.md |
- [ ] 1. List every long-lived holder
- [ ] 2. List what each one holds
- [ ] 3. Check each registration has a matching removal
- [ ] 4. Grade with the checklist
- [ ] 5. Report findings and dismissed candidates
objects, companion fields,
DI singletons and scoped components, ViewModels, app-scoped coroutine scopes, SDK managers,
system services, Handlers, threads and pools.register/add/subscribe/observe/post must have its removal in
the paired lifecycle callback (onStart/onStop, onViewCreated/onDestroyView, effect
onDispose). See the pairing table in
references/listeners-and-callbacks.md.Detect the stack from imports and build files, then load only the matching file.
| Area | Option 1 | Option 2 |
|---|---|---|
| UI | examples/views.md | examples/compose.md |
| DI | examples/dagger-hilt.md | examples/koin.md |
| Async | examples/coroutines-flow.md | examples/rxjava.md |
WeakReference as a last resort: it hides the missing cleanup, and the code then
behaves differently depending on when GC runs.applicationContext fixes Context leaks only for objects that do not need a themed or
Activity context (dialogs, inflation, startActivity need the Activity).checklists/review-checklist.md (opens in a new tab)evals/investigate-cached-component/case.yaml (opens in a new tab)evals/investigate-cached-component/files/leakcanary_trace.txt (opens in a new tab)evals/investigate-cached-component/graders/01-treats-this-as-investigation.md (opens in a new tab)evals/investigate-cached-component/graders/02-identifies-the-static.md (opens in a new tab)evals/investigate-cached-component/graders/03-explains-that-a-di.md (opens in a new tab)evals/investigate-cached-component/graders/04-fixes-it-by-keeping.md (opens in a new tab)evals/investigate-cached-component/graders/05-explains-how-to-verify.md (opens in a new tab)evals/investigate-cached-component/place-files.sh (opens in a new tab)evals/investigate-cached-component/prompt.md (opens in a new tab)evals/review-leaky-fragment/case.yaml (opens in a new tab)evals/review-leaky-fragment/files/LeakyFragment.kt (opens in a new tab)evals/review-leaky-fragment/graders/01-flags-the-binding-that.md (opens in a new tab)evals/review-leaky-fragment/graders/02-flags-the-sessionmanager-listener.md (opens in a new tab)evals/review-leaky-fragment/graders/03-flags-and-recommends.md (opens in a new tab)evals/review-leaky-fragment/graders/04-flags-the-rxjava-subscription.md (opens in a new tab)evals/review-leaky-fragment/graders/05-flags-postdelayed-without-removecallback.md (opens in a new tab)evals/review-leaky-fragment/graders/06-flags-registerforactivityresult-being-ca.md (opens in a new tab)evals/review-leaky-fragment/place-files.sh (opens in a new tab)evals/review-leaky-fragment/prompt.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
2 skills in this plugin
/android-performance:android-performance-memory-leak-preventionfrom android-performance
npx claudepluginhub amolpardeshi99/android-performance-skills --plugin android-performanceOther plugins' skills for the same job