This breakpoint provides an easy way to track view controller deinitialization (deallocation) in UIKit-based applications. This can help finding memory leaks caused by retain cycles preventing view controllers from being deinitialized when dismissed or popped.
From Cédric Luthi's tweet in 2017:
Useful Xcode breakpoint. When you dismiss a controller and you don’t hear the pop sound (or see the log), you probably have a retain cycle.
- In Xcode, go to the Breakpoint navigator (Cmd+8)
- At the bottom-left on the screen, tap '+', then select "Symbolic Breakpoint..." from the menu
- Fill the form:
- Name:
UIViewController dealloc
- Symbol:
-[UIViewController dealloc]
- Module:
UIKitCore
(or leave empty) - Condition:
!(BOOL)([[$arg1 description] containsString:@"Input"])
to excludeUIInputViewController
,UICompatibilityInputViewController
, etc. - Ignore: leave at zero
- Action: Select "Log Message"
- Enter:
--- dealloc @(id)[$arg1 description]@ @(id)[$arg1 title]@
(or customize as needed) - Select "Log message to console"
- Enter:
- Next to "Action: Log Message", tap on '+' to add a new Action
- Select: "Sound" and choose any sound from the list (Submarine, Pop...)
- Check "Automatically continue after evaluating actions" so Xcode does not stop at the breakpoint