I'm trying to do a piecemeal conversion of a big macOS Objective-C++ code base to use Automatic Reference Counting (ARC), and started with a fairly complex modal dialog. I converted all the classes involved to use ARC. When the dialog closes, the window itself, and some of the controller objects, get deallocated as they should, but some do not. When I look at the memory debugging graph in Xcode, I see a bunch of things of the form NSKVONotifying_MyClassName
. Here's an example:
It does not look as though any of my objects have strong references to GRMorphController
, so what am I to make of this?
Are you sure you've stopped observing? Depending on how the previous code functioned, it's possible that you've unintentionally broken the removal process as the object lifetime shifted.
Having said that, I'd also be careful about what you're actually looking "at". KVO can cause odd changes to object lifetime and it's possible you're not actually leaking, just "free-ing later". I'd also be careful about assuming what you're seeing is due to ARC. Unless you've actually compared the two implementations, it's possible you've just noticed an existing bug/behavior.
__
Kevin Elliott
DTS Engineer, CoreOS/Hardware