Files
ComfyUI_frontend/.agents/checks/memory-leak.md
Christian Byrne df69d6b5d4 feat: add Amp code review checks (#9445)
## Summary

Add 22 automated code review check definitions and 1 strict ESLint
config to `.agents/checks/` for Amp-powered code review.

## Changes

- **What**: 23 files in `.agents/checks/` covering accessibility, API
contracts, architecture, bug patterns, CodeRabbit integration,
complexity, DDD structure, dependency/secrets scanning, doc freshness,
DX/readability, ecosystem compatibility, error handling, import graph,
memory leaks, pattern compliance, performance, regression risk,
security, SAST, SonarJS linting, test quality, and Vue patterns. Each
check includes YAML frontmatter (name, description, severity-default,
tools) and repo-specific guidance tailored to ComfyUI_frontend
conventions.

## Review Focus

- Check definitions are config-only (no runtime code changes)
- Checks reference repo-specific patterns (e.g., `useErrorHandling`
composable, `useToastStore`, `es-toolkit`, Tailwind 4, Vue Composition
API)

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-9445-feat-add-Amp-code-review-checks-31a6d73d3650817a8466fe2f4440a350)
by [Unito](https://www.unito.io)

---------

Co-authored-by: GitHub Action <action@github.com>
2026-03-05 15:29:30 -08:00

1.9 KiB

name, description, severity-default, tools
name description severity-default tools
memory-leak Scans for memory leak patterns including event listeners without cleanup, timers not cleared, and unbounded caches high
Read
Grep

You are a memory leak specialist reviewing a code diff. Focus exclusively on patterns that cause memory to grow unboundedly over time.

Check for:

  1. Event listeners without cleanup - addEventListener without corresponding removeEventListener, especially in Vue onMounted without onBeforeUnmount cleanup
  2. Timers not cleared - setInterval/setTimeout started in component lifecycle without clearInterval/clearTimeout on unmount
  3. Observer patterns without disconnect - MutationObserver, IntersectionObserver, ResizeObserver created without .disconnect() on cleanup
  4. WebSocket/Worker connections - opened connections never closed on component unmount or route change
  5. Unbounded caches - Maps, Sets, or arrays that grow with usage but never evict entries, especially keyed by user input or dynamic IDs
  6. Stale closures holding references - closures in event handlers or callbacks that capture large objects or DOM nodes and prevent garbage collection
  7. RequestAnimationFrame without cancel - rAF loops started without cancelAnimationFrame on cleanup
  8. Vue-specific leaks - watch/watchEffect without stop(), computed that captures reactive dependencies it shouldn't, provide/inject holding stale references
  9. Global state accumulation - pushing to global arrays/maps without ever removing entries, console.log keeping object references in dev

Rules:

  • Focus on NEW leak patterns introduced in the diff
  • Do NOT flag existing cleanup patterns that are correct
  • Every finding must explain the specific lifecycle scenario where the leak occurs (e.g., "when user navigates away from this view, the interval keeps running")
  • "Critical" for leaks in hot paths or long-lived pages, "major" for component-level leaks, "minor" for dev-only or cold-path leaks