Skip to content
Back to skills

Memory Leak

ASecurity

Find and fix a memory leak by measuring growth, capturing heaps, and tracing retained references

  • 3 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 3, 2026
ai-agentsgonodedebugging

Works with

  • cli

Security analysis

A100/100

Scanned September 3, 2026

npx -y skills add black141312/ada --skill memory-leak --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Memory Leak?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Memory Leak
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/black141312-memory-leak/badge)](https://www.skillsdirectory.com/skills/black141312-memory-leak)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: memory-leak
description: Find and fix a memory leak by measuring growth, capturing heaps, and tracing retained references
category: debugging
---

# Memory Leak

Use when memory climbs over time and doesn't come back down — RSS growth, OOM kills, GC thrashing, or a process that gets slower the longer it runs. The goal is to find what's still being referenced after it should be free.

1. Confirm it's a real leak: drive a repeating workload and watch memory across cycles — a leak grows monotonically and never returns to baseline after GC.
2. Take a heap snapshot at a steady state, run more cycles, take another, and diff them to see which object types grew.
3. Pick the growing type and inspect its retainer/retention path — find what's holding the reference that should have been released.
4. Trace that reference to the code: usually an unbounded cache/array, an event listener never removed, a closure capturing large state, or a timer never cleared.
5. Break the retention — remove the listener, bound or evict the cache, clear the timer, drop the closure capture — and re-run the cycle test.
6. Verify memory now returns to baseline across many cycles and stays flat under sustained load.

## Rules
- Force/allow GC before measuring, or you'll chase garbage that just hadn't been collected yet.
- Compare snapshots at the same point in the cycle — drift in workload looks like a leak when it isn't.
- The biggest object isn't the leak; the one that keeps growing across snapshots is.
- Common culprits: event emitters, global/module-level collections, caches without eviction, subscriptions, and detached DOM nodes.
- Fix retention, then prove it with a long soak run — a single short run won't show a slow leak.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.