• 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: Autorelease/Retain/Release
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Autorelease/Retain/Release


  • Subject: Re: Autorelease/Retain/Release
  • From: mmalc crawford <email@hidden>
  • Date: Tue, 24 Jul 2007 20:01:08 -0700


On Jul 24, 2007, at 7:18 PM, Tim Davis wrote:

As Charlton put it, the autorelease pool is sometimes quirky as to when it actually gets rid of objects, so I would actually be better off releasing it myself, and keeping the autorelease uses to things like looping through an XML doc or creating one (in this example anyways).

No, this is not correct.

The autorelease pool is *not* quirky as to when it actually gets rid of objects; it sends a release message to all objects that have been autoreleased within its scope when it is itself released. That's it. There is no "quirkiness".

If you are using a loop, you would almost certainly be better off releasing rather than autoreleasing any temporary objects you create with the loop. This is explained (from the opposite perspective) here:
<http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Concepts/AutoreleasePools.html >
(see "Guaranteeing the Foundation Ownership Policy").


mmalc

_______________________________________________

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: Autorelease/Retain/Release
      • From: Charlton Wilbur <email@hidden>
References: 
 >Autorelease/Retain/Release (From: Tim Davis <email@hidden>)
 >Re: Autorelease/Retain/Release (From: Nick Zitzmann <email@hidden>)
 >Re: Autorelease/Retain/Release (From: Tim Davis <email@hidden>)

  • Prev by Date: Re: Autorelease/Retain/Release
  • Next by Date: Re: CoreData: Preventing fault firing
  • Previous by thread: Re: Autorelease/Retain/Release
  • Next by thread: Re: Autorelease/Retain/Release
  • Index(es):
    • Date
    • Thread