• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: ARC dealloc best pratice
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ARC dealloc best pratice


  • Subject: Re: ARC dealloc best pratice
  • From: Jonathan Mitchell <email@hidden>
  • Date: Fri, 06 Feb 2015 20:06:01 +0000

> On 6 Feb 2015, at 17:34, Kyle Sluder <email@hidden> wrote:
>
> Dealloc is too late for a lot of this stuff. I try to keep -dealloc as
> pure as possible; that is, -dealloc should only be concerned with memory
> management.
>
I agree that dealloc is far from perfect. What it does have going for it is ubiquity and reliability.
In also implement a -dispose method that I trigger from -windowWIllClose.
This cascades down the view controller hierarchy but needs a bit of glue of course.

> Removing observers, unbinding, unregistering notifications, and timer
> invalidation all happens in -viewWillMoveToWindow: or another similar
> place.

-viewWillMoveToWindow: can called a lot if a view is repeatedly added and removed from the window view hierarchy.
It would also need hooked up to the view controller to be actually useful.
To be honest the “other place” doesn’t generically exist in my experience.
Hence -dealloc and -dispose.

Jonathan
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden


References: 
 >ARC dealloc best pratice (From: Jonathan Mitchell <email@hidden>)
 >Re: ARC dealloc best pratice (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: ARC dealloc best pratice
  • Next by Date: Re: ARC dealloc best pratice
  • Previous by thread: Re: ARC dealloc best pratice
  • Next by thread: Re: ARC dealloc best pratice
  • Index(es):
    • Date
    • Thread