memory-leak-audit

Audit code for memory leaks and disposable resource management issues.

5|1|Updated Mar 15, 2026
One-click install
npx skills add https://github.com/malwarebo/nyrve --skill memory-leak-audit-malwarebo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: memory-leak-audit
Source: https://github.com/malwarebo/nyrve/tree/main/.github/skills/memory-leak-audit
Command: npx skills add https://github.com/malwarebo/nyrve --skill memory-leak-audit-malwarebo

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the critical issue of memory leaks in code, which can degrade application performance and stability over time, particularly in complex JavaScript environments.

Core Features & Use Cases

  • Event Listener Auditing: Ensures all DOM event listeners are properly managed using addDisposableListener.
  • One-Time Event Handling: Utilizes Event.once() for events that should only trigger a single action, preventing persistent listeners.
  • Resource Management: Guides the correct use of MutableDisposable and DisposableStore for managing disposables in repeated method calls and model lifecycles.
  • Test Validation: Integrates with test suites via ensureNoDisposablesAreLeakedInTestSuite() for automated leak detection.
  • Use Case: When reviewing code that adds event listeners in a loop or within component lifecycles, this skill provides a checklist to ensure no listeners are left dangling, preventing gradual memory bloat.

Quick Start

Use the memory-leak-audit skill to review the provided code for potential memory leaks related to event listeners and disposable objects.

Frequently Asked Questions about memory-leak-audit

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

FAQPage Schema
How do I prevent memory leaks when adding event listeners in a loop?

Prevent memory leaks from loop-added event listeners by using DisposableStore or addDisposableListener to manage listener lifecycles, ensuring proper cleanup and preventing gradual memory bloat in repeated method calls.

What causes memory leaks in TypeScript and JavaScript applications?

Memory leaks in TypeScript and JavaScript applications are frequently caused by dangling event listeners, improperly managed one-time events, and unresolved object lifecycles that retain references and degrade application performance over time.

How do I audit disposable resources and event listeners in code?

Audit disposable resources by validating test suites with ensureNoDisposablesAreLeakedInTestSuite, and review code to enforce best practices like using MutableDisposable, DisposableStore, and Event.once for automated leak detection.

When should I use Event.once instead of standard event listeners?

Use Event.once instead of standard event listeners when handling one-time events that should only trigger a single action, preventing persistent listeners from accumulating and causing memory leaks in JavaScript environments.

How do I validate that my test suite has no disposable resource leaks?

Validate your test suite for disposable resource leaks by integrating ensureNoDisposablesAreLeakedInTestSuite, which automates leak detection and enforces proper resource management across model lifecycles and event handling.

Does this memory leak audit work with plain JavaScript or only TypeScript?

This memory leak audit applies to both JavaScript and TypeScript environments, targeting common disposable resource management issues and event listener patterns that cause memory bloat regardless of the chosen language syntax.