memory-analyzer
Skill1 starsChanged todayMITView on GitHub
Language-independent static and dynamic memory risk analysis. Use when the user asks to analyze code for memory issues, OOM (Out of Memory), stack overflow, memory leaks, unbounded buffer/collection growth, or high peak memory usage in any programming language.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- lodetomasi/claude-code-skills-toolstheir own version, first seen Oct 24, 2025
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- lodetomasi/claude-code-skills-tools★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository38 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agent-orchestratorSkill
- algorithmic-complexity-analyzerSkill
- api-securitySkill
- architectural-planningSkill
- bdd-gherkin-testerSkill
- caching-queues-reviewerSkill
- code-reviewerSkill
- csharp-developerSkill
- design-pattern-detectorSkill
- detect-overengineeringSkill
- github-security-scanner-hookSkill
- java-developerSkill
- legacy-code-modernizationSkill
- llm-as-judgeSkill
- load-memorySkill
- nodejs-executorSkill
- playwright-testerSkill
- powershell-writerSkill
- python-api-writerSkill
- python-developerSkill
- python-linterSkill
- rag-pipelineSkill
- react-developerSkill
- remote-pod-log-analyzerSkill
- researcher-poc-testerSkill
- save-memorySkill
- scan-halucinated-testsSkill
- scan-repo-readmeSkill
- skill-creatorSkill
- skill-doctorSkill
- sql-connectorSkill
- sql-executorSkill
- sync-github-forksSkill
- test-data-creatorSkill
- trace-code-contextSkill
- troubleshoot-and-fixSkill
- typescript-developerSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 6 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 21
Before scanning code, identify:
- Distinctive: line 55
Fix: Use bounded ring buffers, LRU/TTL caches, or periodic compaction/pruning.
- Distinctive: line 68
Fix: Use a mutable builder/buffer with preallocated capacity, or pass read-only views/references.
- Distinctive: line 81
If tests or a runtime environment are available, verify empirically:
- Distinctive: line 82
Steady-State Leak Check: Run the hot path or handler for $N$ iterations (e.g., 1,000 -> 10,000 -> 50,000) and verify resident memory (RSS) …
- Distinctive: line 97
If no issues are found in a category, explicitly state what was checked and why it is bounded.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Memory Analyzer (Language-Independent)
Perform a systematic, language-independent analysis of code to detect and prevent Out-of-Memory (OOM) errors, Stack Overflow crashes, memory leaks, and unbounded heap/stack growth.
Analysis Workflow
1. Establish Scope & Constraints
Before scanning code, identify:
- Execution model: One-shot CLI/script vs. long-running daemon/server/event-loop/tick-handler.
- Hot paths & entry points: Loops, request/message handlers,
OnTick/OnCalculate, stream processors, and recursive functions. - Memory boundaries: Expected max input sizes, concurrency limits, container/process RAM limits, and call-stack size limits.
2. Stack Overflow Analysis (Call Stack & Frame Size)
Inspect for anything that can exhaust the thread or process call stack:
- Unbounded or Input-Controlled Recursion
- Direct or mutual/indirect recursion where depth scales with input size, tree/graph depth, or external data rather than a small constant bound.
- Missing, unreachable, or non-converging base cases.
- Graph/tree traversal without visited tracking (cycles cause infinite recursion).
- Fix: Convert to an explicit heap-allocated stack/queue (iterative traversal), or enforce an explicit
max_depthguard.
- Oversized Stack Frames
- Large fixed-size local arrays, structs, or buffers allocated on the stack inside functions (especially recursive or deeply nested ones).
- Dynamic stack allocations (
alloca, variable-length arrays) driven by untrusted or large sizes. - Fix: Allocate large buffers on the heap, reuse a preallocated scratch buffer, or pass by reference/slice.
- Re-entrant / Cascading Call Chains
- Event emitters, observers, signal handlers, or callbacks that synchronously trigger themselves or re-enter the same handler.
- Fix: Defer re-entrant work to an event queue / trampoline, or guard with a re-entrancy flag.
3. OOM & Unbounded Heap Growth Analysis
Inspect for patterns that cause heap exhaustion or severe memory spikes:
- Unbounded Collections, Caches & Buffers
- Lists, maps, sets, queues, logs, or memoization tables that grow on every request/tick/message without eviction, TTL, or a hard capacity cap (
max_size). - Fix: Use bounded ring buffers, LRU/TTL caches, or periodic compaction/pruning.
- Lists, maps, sets, queues, logs, or memoization tables that grow on every request/tick/message without eviction, TTL, or a hard capacity cap (
- Full-Payload Buffering Instead of Streaming
- Reading entire files, HTTP bodies, database query results, or IPC payloads into memory at once (
read_all,fetchall, loading full history arrays). - Fix: Stream in fixed-size chunks, paginate queries, or process line-by-line / record-by-record.
- Reading entire files, HTTP bodies, database query results, or IPC payloads into memory at once (
- Unbounded Concurrency / Fan-Out
- Spawning tasks, threads, goroutines, or async futures per item in an unbounded loop without a semaphore, worker pool, or backpressure.
- Fix: Bound concurrency with a worker pool / semaphore and apply backpressure to producers.
- Quadratic Allocation & Copy Spikes
- Repeated concatenation of immutable strings, arrays, or byte buffers inside loops.
- Deep-copying large objects/arrays on every iteration or function call instead of passing views/references.
- Fix: Use a mutable builder/buffer with preallocated capacity, or pass read-only views/references.
- Retained References & Hidden Leaks
- Closures / lambdas: Capturing large outer-scope objects or buffers that outlive their need.
- Subscriptions / registries: Event listeners, timers, or global maps where items are registered but never removed on cleanup/error paths.
- Slicing / sub-views: Keeping a small slice/substring that pins a huge backing array/buffer in memory.
- Circular references: Reference cycles in reference-counted runtimes without weak references.
- Manual / native / handle leaks: Heap allocations, file/socket handles, FFI buffers, or platform handles (e.g., indicators, graphic objects, DB cursors) missing deterministic release on all exit/error paths.
4. Dynamic Verification (When Code Can Be Executed)
If tests or a runtime environment are available, verify empirically:
- Steady-State Leak Check: Run the hot path or handler for $N$ iterations (e.g., 1,000 -> 10,000 -> 50,000) and verify resident memory (RSS) / heap stabilizes ($O(1)$ growth) rather than rising monotonically.
- Peak Memory / Large Input Check: Feed worst-case or oversized inputs (deeply nested structures, large files, high concurrency) under a constrained memory/stack limit to confirm graceful bounding or streaming.
5. Output Format
Present findings ordered by severity (Critical -> High -> Medium -> Low). For each finding, report:
- Severity & Category: e.g.,
[Critical] Stack Overflowor[High] Unbounded Heap Growth - Location:
file_path:lineand symbol/function name - Mechanism: Why memory or stack grows (include growth order, e.g., $O(N)$ per tick, $O(D)$ stack frames)
- Trigger: Specific input, duration, or state that causes OOM or stack overflow
- Remediation: Concrete, minimal code change to bound memory/stack usage
If no issues are found in a category, explicitly state what was checked and why it is bounded.
Quick Review Checklist
- All recursion has a guaranteed, small bounded depth (or is iterative).
- No large buffers/arrays are allocated on the call stack.
- All caches, queues, and history buffers have explicit size/TTL limits.
- Large files, streams, and query results are processed in bounded chunks.
- Concurrency/fan-out has bounded worker/queue limits and backpressure.
- Subscriptions, timers, closures, and native/manual handles are released on all paths (including errors).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

