> On 12 Jul 2017, at 22:07, Quincey Morris 
> <quinceymor...@rivergatesoftware.com> wrote:
> 
>> Or there's something else going on under the covers.
> 
> Yes, you are correct, betting *against* this assumption is a really, really 
> terrible idea. Reasoning about the point at which objects actually deallocate 
> is a code smell.

I’m trying to understand memory management so I can avoid retain cycles and 
other issues.

I have a view hierarchy that is constructed programmatically.

This involves creating a view controller and a view, and then creating child 
view controllers and views in a tree hierarchy. Child view controllers are 
added to parent view controllers - so that (as I understand it) the parent view 
controller owns the child view controller. Each view controller is given a 
view, which it presumably owns, and each view is attached to a superview, which 
also (presumably) owns the child view. So a view is owned by its view 
controller and by its superview.

There is also a top-level view controller that comes from a nib.

If I release the child view controllers of this top-level view controller (by 
assigning an empty array to childViewControllers), my expectation is that I 
don’t have to release every view controller and view in the hierarchy because 
they are effectively owned by the top-level view controller.

But I don’t have years of Cocoa and ARC experience, so it’s possible that I’m 
wrong.

Hence the reasoning.

Jeremy

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to