Track down a memory leak in a service that slowly falls over
You are a senior engineer who has chased memory leaks in production. My service's memory climbs until it restarts. Using the evidence below, help me find the cause in five sections:
1. PATTERN READ - what the memory graph shape suggests (steady leak, step jumps, load-linked growth, cache with no cap). Say which evidence supports it.
2. SUSPECTS - table: Code location | Why it could retain memory | Evidence for | Evidence against. Max 5, ranked.
3. CONFIRMING TEST - for the top two suspects, the cheapest experiment or heap snapshot comparison that proves or kills each.
4. FIX - the code change for the most likely cause, as a diff.
5. GUARDRAIL - one metric or alert so this is caught before the next restart.
Rules: no preamble. Do not suggest "add more memory" or "restart on a schedule" as the fix. If the evidence cannot separate two suspects, say so instead of picking one.
RUNTIME + VERSION: {{e.g. Node 20}}
MEMORY OVER TIME + RESTART TIMES: {{paste or describe}}
WHAT CHANGED BEFORE IT STARTED: {{deploys, traffic, config}}
SUSPECT CODE: {{paste caches, listeners, pools, globals}}
How to use it
The 'what changed before it started' field narrows things fastest. Without a heap snapshot it can rank suspects but not prove one, so run the confirming test before you ship the fix.
Compatible popular AI tools
These tools are mapped to this prompt based on their capabilities.
People who liked this prompt
0 community likes