Module 19 Β· Performance & Instruments β Lesson 3 of 4 Β· ~8 min
Memory & retain cycles
ARC frees objects when the last strong reference goes
Swift manages memory with ARC (Automatic Reference Counting): every class instance keeps a count of how many strong references point to it, and when that count hits zero, ARC deallocates it. No garbage collector pausing the app to scan memory β just counting, done at compile time by inserted retain/release calls.
The count only hits zero if nothing still holds a strong reference. A strong reference cycle (also called a retain cycle) is two objects each strongly holding the other β most commonly a closure that captures self strongly, stored on a property of that same self. Neither side's count ever reaches zero, so neither is ever freed: a leak.