← ClaudeAtlas

memory-leak-diagnosis-skilllisted

Diagnose, explain, and fix Swift and Apple-platform memory leaks, unexpected object retention, deinit failures, heap growth, retain cycles, runaway caches, task and AsyncSequence lifetimes, timer/delegate/closure ownership, jetsam, and ARC issues using Xcode Memory Graph and Instruments Allocations, Leaks, and VM tools. Use when objects do not deallocate, memory rises across repeated workflows, or weak/unowned and capture-list choices are unclear. Do not enable Zombies for leak measurement, call every temporary retention a leak, or use unowned without a proven lifetime invariant.
fal3/claude-skills-collection · ★ 18 · AI & Automation · score 79
Install: claude install-skill fal3/claude-skills-collection
# Swift Memory Diagnosis Prove the lifetime bug before changing capture lists. “Memory grew,” “deinit has not run yet,” “an object is retained,” and “an allocation is leaked” describe different evidence. ## Compatibility baseline ARC, weak references, and Xcode’s core memory tools apply across currently supported Swift/Apple-platform projects. State version requirements for the specific APIs in the inspected code: - Structured concurrency and `Task` require Swift 5.5 and the corresponding platform concurrency runtime. - The task example in this skill uses duration-based sleep, available with Swift 5.7-era toolchains and iOS 16 / macOS 13. - Observation, SwiftData, Combine, and framework-specific lifetime rules depend on the app’s declared deployment targets. - Xcode and Instruments UI labels change. Describe goals and inspected relationships, not assumed arrow colors or displayed reference-count numbers. ## Classify the symptom | Observation | Likely category | Best first tool | | --- | --- | --- | | A dismissed screen remains reachable | Unwanted retention / ownership bug | Memory Graph | | Heap grows after repeating one workflow | Persistent allocations, cache, or leak | Allocations generations | | Leaks instrument reports unreachable blocks | Heap leak | Leaks + allocation backtrace | | Memory falls after pressure or cache purge | Cache / transient high-water mark | Allocations + signposts | | Process is killed under memory pressure | Excess footprint / jetsam | Orga