• 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: Methods that return autoreleased objects?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Methods that return autoreleased objects?


  • Subject: Re: Methods that return autoreleased objects?
  • From: Charles Srstka <email@hidden>
  • Date: Sun, 29 Jun 2008 10:02:42 -0500

On Jun 29, 2008, at 1:58 AM, mmalc crawford wrote:

On Jun 28, 2008, at 9:59 PM, Charles Srstka wrote:

Methods that begin with "alloc" or "new" or contain "copy" will return objects you are responsible for. All other objects returned from methods are taken care of.

Well, there is the notable exception of top-level objects loaded from a NIB file, which do need to be released.


... which is documented:
<http://developer.apple.com/documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/chapter_3_section_3.html# >


mmalc

Yes, but it's not obvious, which is why I thought to point it out since we're discussing the times when you should and shouldn't release objects. The alloc, init, and retain methods are also documented, but that doesn't mean we can't help people out with them, does it? I just think that the standard "release something only if you inited or retained it" advice should be amended to "release something only if you inited or retained it, or if you got it from a NIB."


I know this confused *me* back when I was starting out, so I just thought I'd throw that out there.

Charles
_______________________________________________

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


  • Follow-Ups:
    • Re: Methods that return autoreleased objects?
      • From: Mike Ferris <email@hidden>
    • Re: Methods that return autoreleased objects?
      • From: mmalc crawford <email@hidden>
References: 
 >Methods that return autoreleased objects? (From: "john muchow" <email@hidden>)
 >Re: Methods that return autoreleased objects? (From: Markus Spoettl <email@hidden>)
 >Re: Methods that return autoreleased objects? (From: Charles Srstka <email@hidden>)
 >Re: Methods that return autoreleased objects? (From: mmalc crawford <email@hidden>)

  • Prev by Date: Re: Widgets for HUD
  • Next by Date: [ANN] Amber.framework, shared source repository
  • Previous by thread: Re: Methods that return autoreleased objects?
  • Next by thread: Re: Methods that return autoreleased objects?
  • Index(es):
    • Date
    • Thread