1.0 KiB
1.0 KiB
description
| description |
|---|
| Detect potential memory leaks in code |
Memory Leak Detector
Analyze code for potential memory leaks and improper resource management.
Detection Patterns
- Event Listeners: Unremoved event listeners
- Closures: Variables captured in closures preventing GC
- Timers: Uncancelled setTimeout/setInterval
- Cache Growth: Unbounded cache or collection growth
- Circular References: Objects referencing each other
- DOM References: Detached DOM nodes held in memory
- Global Variables: Unnecessary global state accumulation
Analysis Process
- Search for common leak patterns in codebase
- Identify resource allocation without cleanup
- Check for proper disposal in cleanup methods
- Analyze object lifecycle management
- Generate detailed report with locations and fixes
Output
Provide markdown report with:
- Identified leak patterns with severity ratings
- File locations and line numbers
- Code snippets showing the issue
- Recommended fixes with examples
- Prevention strategies