objc-block-retain-cycles
CommunityEliminate Objective-C block memory leaks, guaranteed.
AuthorCharlesWiltgen
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This Skill provides a systematic approach to diagnose and fix Objective-C block retain cycles, the leading cause of memory leaks, app crashes, and "sending message to deallocated instance" errors. It prevents silent memory accumulation and ensures app stability.
Core Features & Use Cases
- Systematic Diagnosis: Mandatory first steps using Instruments (Allocations, Memory Debugger) to confirm, trace, and understand retain cycles.
- Weak-Strong Pattern Enforcement: Detailed guidance on correctly applying the
__weak typeof(self) weakSelf = self;andif (strongSelf)pattern to break cycles. - Hidden Capture Detection: Identifies subtle
selfcaptures within macros (e.g.,NSAssert,NSLog) and ensures proper guarding in nested blocks. - Use Case: When a
UIViewControllerisn't deallocating after being dismissed, use this skill to systematically check forselfreferences in any blocks assigned to properties or network operations, then apply the weak-strong pattern to break the cycle.
Quick Start
To diagnose a suspected block retain cycle, first use Instruments' Allocations template to confirm memory isn't returning to baseline after dismissing a screen.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: objc-block-retain-cycles Download link: https://github.com/CharlesWiltgen/Axiom/archive/main.zip#objc-block-retain-cycles Please download this .zip file, extract it, and install it in the .claude/skills/ directory.