ios-memgraph-leaks

Capture and inspect iOS simulator memgraphs to diagnose memory leaks and retain cycles.

Updated Jul 31, 2026
One-click install
npx skills add https://github.com/AarnavBaddam/skills --skill ios-memgraph-leaks-aarnavbaddam
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ios-memgraph-leaks
Source: https://github.com/AarnavBaddam/skills/tree/main/ios-memgraph-leaks
Command: npx skills add https://github.com/AarnavBaddam/skills --skill ios-memgraph-leaks-aarnavbaddam

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? Debugging iOS memory leaks requires capturing memory graphs from running simulator processes and interpreting Apple's leaks output, which is tedious and error-prone when done manually. This Skill automates memgraph capture, leak summarization, and ownership-path analysis so you can prove and fix retain cycles with before/after evidence. ## Core Features & Use Cases - Memgraph Capture: Capture a .memgraph from a running iOS simulator app by UDID and bundle identifier using the capture_sim_memgraph.sh script. - Leak Summarization: Parse leaks output into a Markdown report with top leaked types, images, traceTree excerpts, and grouped leak trees via summarize_memgraph_leaks.py. - Root-Cause Workflow: Follow structured rules for identifying app-owned leaked types, proving retain cycles with ownership paths, and verifying fixes with before/after captures. - Use Case: After driving a flow that should release objects, capture a memgraph, summarize the leaks, trace the retaining edge for an app-owned type, apply the smallest fix, and recapture to prove the leak disappeared. ## Quick Start Use the ios-memgraph-leaks skill to capture a memgraph from my running simulator app and summarize which objects are leaking.

Frequently Asked Questions about ios-memgraph-leaks

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I capture a memgraph from a running iOS simulator app?

Run capture_sim_memgraph.sh with the simulator UDID and app bundle identifier. The script resolves the running PID via xcrun simctl launchctl list and invokes the leaks tool with --outputGraph to write a .memgraph file plus metadata to your output directory.

How do I find retain cycles in an iOS memgraph?

Summarize the memgraph with summarize_memgraph_leaks.py, then run leaks --traceTree=<address> on app-owned leaked types to see the ownership path. For unreachable self-retained cycles with no root path, use leaks --groupByType and source verification to find the retaining edge.

Why does the memgraph capture fail to find my app process?

The script fails when no running PID matches the bundle identifier on the given simulator. Confirm the bundle ID is correct and inspect running labels with xcrun simctl spawn <udid> launchctl list, since the app must be launched on that simulator first.

Can I analyze an existing .memgraph file without a simulator?

Yes, summarize_memgraph_leaks.py accepts any existing .memgraph file path and produces a Markdown summary with top leaked types, images, trace excerpts, and grouped leak trees. Only the capture step requires a live simulator process.

What counts as proof that an iOS memory leak is fixed?

A credible fix shows the ownership path that kept the object alive and demonstrates that the same type or path disappears in a recaptured memgraph from the same flow. A smaller total leak count alone is not sufficient evidence.