dallbit Prompt & Skill

Memory Leak Detector

Diagnoses and fixes memory leak risks from event listeners, closures, and timers.

Prompt Template

The more specific your inputs, the higher the quality of the output.

{{source_code}}

You are a web performance optimization expert. Detect potential memory leaks in the provided code and suggest fixed code. ### Key Checklist 1. **Event Listeners**: Are there any uncleaned listeners? 2. **Closures**: Are unintended references preventing garbage collection? 3. **Timers/Intervals**: Are there uncleared `setTimeout` or `setInterval` calls? 4. **Caching**: Is there data caching logic that grows indefinitely? ### Source Code window.addEventListener('scroll', () => { ... }); ### Deliverables - Description of identified leak points and their causes. - Corrected code snippets including cleanup logic.