• 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 clean up?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ARC clean up?


  • Subject: Re: ARC clean up?
  • From: Kyle Sluder <email@hidden>
  • Date: Wed, 14 May 2014 09:17:39 -0700

On May 14, 2014, at 9:12 AM, William Squires <email@hidden> wrote:
>
> Okay, in non-ARC code, one would override dealloc to put clean-up code (to release retained objects, close open streams/files, etc...). But where do we put this in ARC code?

You can still override -dealloc in ARC. You just can't release anything (ARC will do that for you; you can assign to nil if you need explicitly clear the pointer), nor can you call [super dealloc] (again, ARC will do that for you at the end of your -dealloc implementation).

But you should not be holding on to resources like file handles until -dealloc. You have no idea who might have retained a pointer to your object—use an explicit -close method instead.

--Kyle Sluder
_______________________________________________

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 clean up? (From: William Squires <email@hidden>)

  • Prev by Date: Re: ARC clean up?
  • Next by Date: Re: Subclassing and private methods
  • Previous by thread: Re: ARC clean up?
  • Next by thread: Bug with Airlocate
  • Index(es):
    • Date
    • Thread