0Pricing
Objective-C iOS Development for Legacy & Enterprise Apps · Lesson

Breaking Retain Cycles in Blocks

Diagnose and fix the most common ARC memory leak in legacy apps: retain cycles caused by blocks capturing self, using weak and strong references.

What is a Retain Cycle?

A retain cycle happens when two objects strongly reference each other. Neither's count can reach zero, so neither is ever freed — a memory leak ARC cannot break for you.

Blocks Capture Strongly

An Objective-C block captures the variables it uses, including self — and it captures them strongly by default. This is the number one source of cycles.

All lessons in this course

  1. Manual Retain-Release (MRR) Basics
  2. Automatic Reference Counting (ARC)
  3. Weak vs. Strong References
  4. Breaking Retain Cycles in Blocks
← Back to Objective-C iOS Development for Legacy & Enterprise Apps