Skip to content
Back to skills

Memory Leak

ASecurity

Finds potential memory leaks - uncleaned listeners, unclosed connections, growing caches

  • 10 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added June 1, 2026
ai-agents

Security analysis

A100/100

Scanned June 1, 2026

npx -y skills add berkcangumusisik/claude-code-practices --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/berkcangumusisik-memory-leak/badge)](https://www.skillsdirectory.com/skills/berkcangumusisik-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: Finds potential memory leaks - uncleaned listeners, unclosed connections, growing caches
argument-hint: [file-path]
user-invocable: true
allowed-tools: Read Grep Glob
effort: medium
---

## Memory Leak Analysis

Target: **$1** (or `src/` if not specified)

### Pattern 1: Event Listeners Without Cleanup
```ts
// ❌ Listener added but never removed
useEffect(() => {
  window.addEventListener('resize', handler)
}, []) // Missing: return () => window.removeEventListener('resize', handler)
```

### Pattern 2: Timers Not Cleared
```ts
// ❌ Interval runs forever
setInterval(syncData, 5000)

// ✅ Store ref and clear on unmount
const id = setInterval(syncData, 5000)
return () => clearInterval(id)
```

### Pattern 3: Unbounded Caches
```ts
// ❌ Cache grows indefinitely
const cache = new Map()
cache.set(key, value) // never evicted
```

### Pattern 4: Unclosed DB/File Connections
Look for `db.connect()` without corresponding `db.close()` in error paths.

---

For each finding:
1. Show the leaking code
2. Explain what accumulates and why it matters
3. Provide the fix

Rate by severity: **Critical** (crashes in production under load) / **Warning** (gradual degradation) / **Minor** (theoretical).

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…