memory-leak-audit

Solid

Audit code for memory leaks and disposable issues. Use when reviewing event listeners, DOM handlers, lifecycle callbacks, or fixing leak reports. Covers addDisposableListener, Event.once, MutableDisposable, DisposableStore, and onWillDispose patterns.

Code & Development 8 stars 0 forks Updated today MIT

Install

View on GitHub

Quality Score: 78/100

Stars 20%
32
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# Memory Leak Audit The #1 bug category in VS Code. This skill encodes the patterns that prevent and fix leaks. ## When to Use - Reviewing code that registers event listeners or DOM handlers - Fixing reported memory leaks (listener counts growing over time) - Creating objects in methods that are called repeatedly - Working with model lifecycle events (onWillDispose, onDidClose) - Adding event subscriptions in constructors or setup methods ## Audit Checklist Work through each check in order. A single missed pattern can cause thousands of leaked objects. ### Step 1: DOM Event Listeners **Rule**: Never use raw `.onload`, `.onclick`, or `addEventListener()` directly. Always use `addDisposableListener()`. ```typescript // BAD — leaks a listener every call this.iconElement.onload = () => { ... }; // GOOD — tracked and disposable this._register(addDisposableListener(this.iconElement, 'load', () => { ... })); ``` **Validated by**: PR #280566 — Extension icon widget leaked 185 listeners after 37 toggles. ### Step 2: One-Time Events **Rule**: Use `Event.once()` for events that should only fire once (lifecycle events, close events, first-change events). ```typescript // BAD — listener stays registered forever after first fire model.onDidDispose(() => store.dispose()); // GOOD — auto-removes after first invocation Event.once(model.onDidDispose)(() => store.dispose()); ``` **Validated by**: PRs #285657, #285661 — Terminal lifecycle hacks replaced with `Event.once()`. ### S...

Details

Author
chapmanjw
Repository
chapmanjw/clawdius
Created
1 months ago
Last Updated
today
Language
TypeScript
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Listed

memory-leaks-and-diagnostics

Review .NET code for managed memory leaks - event handler leaks, static caches, timers, CancellationTokenRegistration, closure captures - and how to diagnose with dotnet-counters/gcdump. Use when reviewing long-lived objects, event subscriptions, or investigating memory growth.

0 Updated today
Sarmkadan
Code & Development Solid

awesome-leak-audit

Audit a public-facing client (browser extension, mobile/desktop app, SPA, CLI, SDK, or any open-sourced client that talks to a private backend) so its public surface stays self-contained and doesn't help attackers. Use when asked to review a repo for leaked backend internals, secrets, or abuse-enabling disclosure; to check that comments/docs/tests don't reveal server-side mechanics (rate limits, anti-abuse, quotas, test backdoors, infra/tech stack, DB/schema, env-var names); to scrub a client before open-sourcing or a store/app-store submission; or for client-side security hardening (permissions, IPC/message sender validation, auth-token handling, DOM/XSS sinks, build-time config, secret bundling). Triggers: 'audit for leaks', 'does this leak backend details', 'is this safe to make public', 'security review of the client/extension', 'what does our API disclose', 'harden the client'.

2 Updated today
khasky
DevOps & Infrastructure Listed

audit

Comprehensive codebase audit skill covering 10 systemic bug categories plus CI automation. Use this skill proactively during code review, E2E testing, pre-deployment checks, or whenever you spot any of these patterns — raw database values in UI (snake_case, camelCase enums, numeric codes), API contract mismatches between client and server, Firestore/database rules gaps, CORS missing production domains, analytics/consent gating features, dynamic Tailwind/CSS classes purged in prod, window.open without noopener, orphaned data on deletion, hardcoded secrets, Android/iOS security misconfigs, performance regressions (bundle size, re-renders, lazy loading), or accessibility gaps (missing aria labels, keyboard nav, screen reader). Also triggers on "audit this", "did you check everything", "is this production ready", "what did we miss", "are you sure", or any thoroughness question. One bug instance always means many more exist — this skill enforces the ripple search.

0 Updated 4 days ago
aksheyw