• 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: Memory management on returning nil in init
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory management on returning nil in init


  • Subject: Re: Memory management on returning nil in init
  • From: Ken Thomases <email@hidden>
  • Date: Mon, 21 Jun 2010 09:50:43 -0500

On Jun 21, 2010, at 9:43 AM, Eiko Bleicher wrote:

> One of my initializers can fail and thus it should return nil. Consider the following example:

> Does this code leak? I am inclined to think I need to call [self release] before returning nil

Yes, you need to release self.  This is documented here (among other places):
<http://developer.apple.com/mac/library/documentation/cocoa/conceptual/objectivec/Articles/ocAllocInit.html#//apple_ref/doc/uid/TP30001163-CH22-SW13>

Cheers,
Ken

_______________________________________________

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: 
 >Memory management on returning nil in init (From: Eiko Bleicher <email@hidden>)

  • Prev by Date: Re: Memory management on returning nil in init
  • Next by Date: Re: Memory management on returning nil in init
  • Previous by thread: Re: Memory management on returning nil in init
  • Next by thread: Re: Memory management on returning nil in init
  • Index(es):
    • Date
    • Thread