memory-leak-audit

Audit TypeScript code for memory leaks and disposable pattern misuse.

Updated Mar 19, 2026
One-click install
npx skills add https://github.com/Nithwin/shadowcode --skill memory-leak-audit-nithwin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: memory-leak-audit
Source: https://github.com/Nithwin/shadowcode/tree/main/.github/skills/memory-leak-audit
Command: npx skills add https://github.com/Nithwin/shadowcode --skill memory-leak-audit-nithwin

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Memory leaks and improper disposable patterns are a major source of performance degradation in long-running ShadowCode-like apps. This skill provides a structured audit checklist to detect and fix event listeners, disposables, and lifecycle misuses in TypeScript-based codebases.

Core Features & Use Cases

  • Step-by-step guidance for common leak patterns: raw event handlers, repeated registrations, and non-cleanup lifecycle hooks.
  • Applicability to extensions, UI components, services, and models with long lifetimes that register listeners.
  • Use case: when reviewing code that adds listeners in constructors or repeatedly creates subscriptions, to ensure they are disposed correctly.

Quick Start

Run a targeted audit of the target module to identify and fix memory-leak patterns according to the checklist.

Frequently Asked Questions about memory-leak-audit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I audit TypeScript code for memory leaks from event listeners?

To audit TypeScript code for memory leaks, enforce disposable patterns by checking that event listeners and lifecycle handlers are correctly disposed using structures like DisposableStore and addDisposableListener during code reviews.

What are common memory leak patterns in TypeScript UI components?

Common memory leak patterns in TypeScript UI components include raw event handlers, repeated listener registrations, and non-cleanup lifecycle hooks. These issues are detected by verifying proper cleanup via disposable patterns like MutableDisposable.

How do I ensure proper disposal of event subscriptions in TypeScript?

Ensure proper disposal of event subscriptions by applying patterns like Event.once and DisposableStore. This verifies that subscriptions added in constructors or repeatedly are correctly cleaned up to prevent memory leaks.

When do I need to use disposable patterns in TypeScript applications?

You need disposable patterns in TypeScript applications when reviewing code with long-running services, extensions, or UI components that register listeners. This ensures objects are disposed correctly and prevents performance degradation from memory leaks.

Can I use this memory leak audit for TypeScript services with long lifetimes?

Yes, this memory leak audit applies to TypeScript services, models, and extensions with long lifetimes that register listeners. It provides a structured checklist to verify proper cleanup of event subscriptions and lifecycle handlers.