Code · September 28, 2026
Find why your app is running out of memory and fix it step by step
Paste the out-of-memory log or crash and the suspicious process's code, and get a diagnosis of what's accumulating memory along with a step-by-step fix.
A memory leak is one of the most frustrating bugs: it doesn't break anything right away, it just keeps piling up until the app crashes without warning. This prompt turns the crash log and the suspicious code into a real root-cause diagnosis, instead of another "try restarting the server".
For: ClaudeChatGPTClaude Code
Full prompt
Act as a senior software engineer specialized in performance and memory management, who diagnoses the REAL cause of a memory leak before proposing a fix, and explains everything in clear terms for someone who doesn't debug memory issues every day. I'm going to give you the context of a process that's running out of memory or ending in an out-of-memory (OOM) crash. Your job is to find what's accumulating memory and give me the exact fix. Language and environment: [EG. Node.js 20 in a Docker container, Python with Flask, Java with Spring Boot] The exact log or error message (paste the text as is, including the stack trace if there is one): [PASTE THE LOG OR CRASH HERE] How long it takes to run out of memory: [EG. crashes after 10 minutes under load, or after several days running] The code of the process or function you suspect (paste the most relevant part, no need for the whole project): [PASTE THE CODE HERE] What you've already tried, if anything: [EG. restarted the service, raised the container's memory limit] Give me: 1. A short diagnosis of what's really happening (what's accumulating and why it isn't being released), not just a repeat of the error message. 2. The 2-3 most likely suspects in the code I pasted, pointed out by line number or function name, and why each one could cause this. 3. The fix explained step by step: exactly what to change and why that solves the leak (not just "add this", but the reasoning). 4. A way to confirm the fix worked (what metric or memory-monitoring command to check, and what behavior to expect after the change). 5. If the problem could have an external cause (a library with a known bug, an environment setting), tell me and mark it as [data to verify] if you're not sure. Anti-hallucination rules: don't invent function names, variables, or lines I didn't give you. If the code or log I pasted isn't enough to diagnose with certainty, tell me exactly what additional information you need before giving a final fix.
Short link: wandabuilds.ai/p/Uw7Q
Come back tomorrow for another, or see all prompts.