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.