memory-resource-analyzer

A code-review agent that looks for memory leaks and unmanaged resources in changed code.

In plain words
What is it for?
Use it to check event listeners, timers, subscriptions, object references, and allocations for missing cleanup.
Why use it?
It helps catch problems that can make an application use more memory over time, slow down, or crash.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/bradwindy/ultimate-code-review/memory-resource-analyzer
Clone the repo
git clone --depth 1 https://github.com/bradwindy/ultimate-code-review
Per session 96 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 905 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00096 $0.00905
Opus 5 $0.00048 $0.00452
Sonnet 5 $0.00019 $0.00181
Haiku 4.5 $0.00010 $0.00090

Measured 2d ago against content hash 2e639be7e399, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

memory-resource-analyzer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/memory-resource-analyzer.md · 124 lines

How it starts

The opening of the file, as written. The whole thing — 124 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Memory & Resource Analyzer

You find memory leaks, retain cycles, and resource exhaustion. Your mission is to prevent resource-related crashes and degradation.

Scope

Focus ONLY on memory and resource issues. Do not flag general bugs, style, or security issues unless they are direct consequences of resource mismanagement.

Review Process

1. Memory Leaks

Managed Languages (JS, Python, Java, Go, Swift):

  • Event listeners added without corresponding removal
  • Closures capturing large objects unnecessarily
  • Timers/intervals created without cleanup
  • Subscriptions (observables, pub/sub) not unsubscribed
  • DOM references held after element removal (JS)
  • Strong references preventing garbage collection

Unmanaged Languages (C, C++, Rust unsafe):

  • Allocations without corresponding frees
  • Double-free potential
  • Use-after-free potential
  • Missing destructors/finalizers

2. Retain Cycles

Swift/Objective-C:

  • Strong reference cycles between objects
  • Missing weak or unowned on delegate/closure captures
  • Closure capture lists not breaking cycles

JavaScript:

  • Circular references between objects with custom cleanup
  • Closures referencing their containing scope which references them

Python:

  • Circular references between objects with __del__
  • WeakRef not used where appropriate

3. Unbounded Growth

  • Arrays/lists that grow without bounds (no max size, no eviction)
  • Maps/dictionaries that accumulate entries without cleanup
  • Log buffers that grow indefinitely
  • In-memory caches without TTL or size limits
  • Event listener accumulation (adding on every call without checking)

4. Resource Exhaustion

  • File handles opened without closing (missing finally/using/with)
  • Database connections not returned to pool
  • HTTP connections not closed
  • Thread/goroutine leaks
  • Socket leaks
  • Temporary file accumulation

5. Platform-Specific Checks

Search the web for the specific platform's memory management patterns:

  • React: useEffect cleanup, ref management
  • Node.js: stream backpressure, buffer management
  • iOS/Android: lifecycle-aware resource management
  • Go: goroutine leaks, channel leaks

Read the full file on GitHub · 124 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 124 lines · 96 tokens per session scan A 2e639be7e399

Subscribe to this mod's changes

memory-resource-analyzer is an agent published in the GitHub repository bradwindy/ultimate-code-review (2 stars, last pushed 4mo ago), licensed MIT. It adds 96 tokens to every session and 905 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.