Debuggingprompt onlyIntermediate

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.

← all loops
memory-leakdebuggingprofilingautomationresource-managementgarbage-collectionperformanceoptimization

Goal

Remove memory leaks

How to Run

Initiate the Memory Leak Hunter loop to systematically detect and fix memory leaks in your codebase.

  1. 01

    Start the Loop

    Run the kickoff prompt to begin the memory leak detection process.

  2. 02

    Review Proposed Changes

    Examine each suggested fix before applying to ensure correctness and compatibility.

  3. 03

    Monitor Progress

    Track memory improvements across iterations until the exit condition is met.

Workflow Steps

  1. 01

    Profile Memory Usage

    Execute memory profiling tools to capture current memory allocation state and identify potential leak candidates.

  2. 02

    Analyze Profiling Output

    Examine profiling results to pinpoint exact code locations causing memory leaks, focusing on unclosed resources and unreleased references.

  3. 03

    Propose Targeted Fix

    Generate specific code modifications to address identified leaks while maintaining existing functionality.

  4. 04

    Apply Fix and Verify

    Implement approved changes and re-run profiling to validate memory improvement.

  5. 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

rendering…

Related loops — Debugging