ios-memgraph-analysis — Claude Code skill: iOS memory leak analysis
A skill for reading iOS .memgraph files: it separates unreachable leaks from reachable heap growth and keeps the raw tool output.
npx skills add dpearson2699/swift-ios-skills --skill ios-memgraph-analysis -a claude-codeWhat ios-memgraph-analysis does
This skill handles memory graphs from iOS apps and shows why an object outlives the point where it should have gone away. Unreachable leaks and reachable growth stay separate here, raw tool output is kept, and after a fix the same app-owned type and ownership path get checked again.
Two Python scripts do the work. scripts/capture_sim_memgraph.py grabs a graph from a running Simulator app: it takes --bundle-id, --output-dir and --pretty, shells out to leaks --outputGraph, and writes a manifest. scripts/summarize_memgraph.py parses the graph, drops raw artifacts into their own directory, and supports --app-image, --trace-limit, --group-by-type and --reference-tree. With several Simulators booted you need --udid; the script matches exactly one launchd label and one PID and errors out on zero or multiple hits. Capturing suspends the process, so latency numbers from a capture mean nothing.
The order matters. Name the object and the event that ends its useful life first, then run one fixed sequence of steps before and after the graph. Keep the build, the data and the Malloc Stack Logging setting identical between runs, or the comparison falls apart. Apple does not treat these text formats as stable schemas, so parser warnings are a reason to open the raw artifacts, not to soften the parser. Interactive Memory Graph Debugger, Instruments and LLDB work belong to the debugging-instruments skill.
What it helps with
- prove an object survives past its expected lifetime boundary
- tell an unreachable leak apart from reachable heap growth
- capture a memory graph from a running Simulator app
- locate the first app-owned strong edge in an ownership path
- compare baseline and post-flow graphs from the same flow
Example prompts for the agent
- Capture a memory graph from the running app by
--bundle-idand keep the raw artifacts - Parse the
.memgraphand show which app types still hold memory after the editor closes leaksreports nothing but the heap keeps growing — diff the baseline and post-flow graphs
How to install ios-memgraph-analysis
1Skills CLI (Vercel)
npx skills add dpearson2699/swift-ios-skills --skill ios-memgraph-analysis -a claude-code2Manually: put the files in place
~/.claude/skills/ios-memgraph-analysis/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/ios-memgraph-analysis/
1Skills CLI (Vercel)
npx skills add dpearson2699/swift-ios-skills --skill ios-memgraph-analysis -a codex2Manually: put the files in place
.agents/skills/ios-memgraph-analysis/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add dpearson2699/swift-ios-skills --skill ios-memgraph-analysis -a cursor2Manually: put the files in place
.cursor/skills/ios-memgraph-analysis/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install dpearson2699/swift-ios-skills ios-memgraph-analysis2Manually: put the files in place
.github/skills/ios-memgraph-analysis/SKILL.md1Skills CLI (Vercel)
npx skills add dpearson2699/swift-ios-skills --skill ios-memgraph-analysis -a gemini-cli2Platform CLI
gemini skills install https://github.com/dpearson2699/swift-ios-skills --path skills/ios-memgraph-analysisManually: put the files in place
.devin/skills/ios-memgraph-analysis/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add dpearson2699/swift-ios-skills --skill ios-memgraph-analysis -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about ios-memgraph-analysis
How do I install ios-memgraph-analysis in Claude Code?
Run npx skills add dpearson2699/swift-ios-skills --skill ios-memgraph-analysis -a claude-code. The skill lands in ~/.claude/skills/ios-memgraph-analysis/SKILL.md.
What does ios-memgraph-analysis do?
It reads .memgraph files and Apple command-line output: it splits unreachable leaks from reachable growth, preserves raw leaks, heap, vmmap and malloc_history output, and re-checks the same ownership path after a fix.
How is it different from debugging-instruments?
This skill covers .memgraph capture and command-line ownership analysis. The interactive Memory Graph Debugger, Instruments, generic retain-cycle inspection and LLDB work are handled by debugging-instruments.