memory-debugging

Diagnose memory leaks in iOS/macOS apps using Instruments and Memory Graph Debugger.

1.1k|81|Updated Nov 30, 2025
One-click install
npx skills add https://github.com/CharlesWiltgen/Axiom --skill memory-debugging-charleswiltgen
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: memory-debugging
Source: https://github.com/CharlesWiltgen/Axiom/tree/main/.claude-plugin/plugins/axiom/skills/memory-debugging
Command: npx skills add https://github.com/CharlesWiltgen/Axiom --skill memory-debugging-charleswiltgen

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Memory issues cause crashes after long use. This Skill teaches systematic memory leak diagnosis with Instruments, patterns, and memory graph techniques.

Core Features & Use Cases

  • Detect common leak patterns: retain cycles, timers, observers
  • Instruments workflows and Memory Graph Debugger usage
  • Guidance on fixing leaks and validating fixes

Quick Start

Prompt: "Diagnose a growing memory leak in a view model and propose fixes."

Frequently Asked Questions about memory-debugging

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

FAQPage Schema
How do I detect memory leaks in iOS and macOS apps using Instruments?

Memory leaks in iOS/macOS apps appear as growing memory usage during prolonged use. Instruments provides systematic workflows to isolate leaks: use the Allocations instrument to track heap growth, then Memory Graph Debugger to visualize object references and identify retain cycles, timer leaks, and observer leaks blocking deallocation.

What are retain cycles and how do I find them?

Retain cycles occur when objects hold strong references to each other, preventing deallocation. Memory Graph Debugger flags these as purple warnings. Common causes include closures capturing self, delegate patterns without weak references, and circular property references. Systematically convert strong captures to weak to break cycles.

Why does my app crash after running for a long time?

Extended runtime crashes typically signal memory pressure from unbounded leaks. Common patterns include timers or observers never unregistered, collections growing without bounds, and retained view controllers. Use Instruments to measure memory growth over time, then Memory Graph Debugger to classify the leak pattern and apply targeted fixes.

How do I verify that a memory leak fix actually works?

Reproduction and verification require systematic testing. After applying fixes—weak references, proper deallocation, observer cleanup—rerun the Instruments Allocations workflow on the same user scenario. Confirm memory stabilizes rather than grows, and validate with Memory Graph Debugger that previously flagged retain cycles no longer appear.

What memory leak patterns should I look for first?

Start with the three most common patterns: retain cycles (strong self in closures or delegates), timer and notification observer leaks (unregistered listeners), and unbounded collection growth (caches or buffers without limits). Memory Graph Debugger highlights retain cycles; Instruments Allocations reveals growth trends; check code for unbalanced registration calls.

Can I use Memory Graph Debugger without Instruments?

Memory Graph Debugger is a standalone Xcode debugging tool that works independently to visualize object references and identify retain cycles in a running app. Instruments complements it by tracking memory trends over time. Together they provide systematic diagnosis: Instruments shows what grows, Memory Graph shows why it doesn't deallocate.