Memory Leak Hunter
This loop automatically detects and resolves memory leaks in your application through iterative profiling and code fixes. It runs memory profiling tools, analyzes output to identify leak sources, proposes targeted changes, and validates fixes until memory usage stabilizes.
Goal
Remove memory leaks
How to Run
Initiate the Memory Leak Hunter loop to systematically detect and fix memory leaks in your codebase.
- 01
Start the Loop
Run the kickoff prompt to begin the memory leak detection process.
- 02
Review Proposed Changes
Examine each suggested fix before applying to ensure correctness and compatibility.
- 03
Monitor Progress
Track memory improvements across iterations until the exit condition is met.
Workflow Steps
- 01
Profile Memory Usage
Execute memory profiling tools to capture current memory allocation state and identify potential leak candidates.
- 02
Analyze Profiling Output
Examine profiling results to pinpoint exact code locations causing memory leaks, focusing on unclosed resources and unreleased references.
- 03
Propose Targeted Fix
Generate specific code modifications to address identified leaks while maintaining existing functionality.
- 04
Apply Fix and Verify
Implement approved changes and re-run profiling to validate memory improvement.
- 05
Evaluate Exit Condition
Check if memory usage has stabilized; if not, repeat cycle or exit after max iterations.
Kickoff Prompt
Start the "Memory Leak Hunter" loop. Goal: Remove memory leaks Max iterations: 10 Between iterations run: memory profiling Exit when: Memory usage stable Start the Memory Leak Hunter loop. First, run memory profiling on the current codebase to identify any potential memory leaks. Analyze the output and propose specific fixes. Continue iterating until memory usage stabilizes or we reach maximum iterations. Self-pace this loop. After each iteration, run `memory profiling` and evaluate the output, and only continue if the exit condition is not met (Memory usage stable). Stop when the exit condition passes or 10 iterations are reached. Give a short status update each pass.
Guardrails
hardcoded- ·Only modify code files related to identified memory leaks
- ·Preserve original functionality during fixes - no behavioral changes
- ·Use version control to track all modifications
- ·Require user approval before applying any code changes
- ·Limit scope to application source code, not system libraries
Flow Diagram
Related loops — Debugging
Debugging
Reproduce and Fix
This loop guides you through reproducing a reported bug, identifying its root cause, implementing a fix, and verifying the solution through automated testing. The agent will iteratively work to resolve the issue while maintaining system integrity.
Debugging
Error Log Reduction
This loop analyzes application error logs to identify and fix recurring errors, reducing their frequency over time through iterative debugging and targeted code improvements.
Debugging
Production Incident Resolver
A coding agent loop designed to diagnose and resolve production incidents through iterative investigation, targeted fixes, and continuous health monitoring until system stability is restored.