• 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: Nick Zitzmann <email@hidden>
  • Date: Tue, 24 Jul 2007 20:01:23 -0600


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

Does this mean that if I don't send the object a [retain] call during the [[blah alloc] init] statement that I don't need to send it a [release] later on? Yes I have read the docs, just unsure about it.

Incorrect. Objects created with alloc/init are not autoreleased, so they must be manually released, unless you're using Leopard and have garbage collection turned on.


I created an autorelease pool farther up the awakeFromNib function. Please look at indexRoot, indexFile, and xmlData. If I understand this correctly I need to use autorelease on indexRoot and indexFile because I'm alloc'ing and init'ing? And xmlData is automagicly destroyed when awakeFromNib exits?

Correct, although you don't have to create your own pools unless:
1. You just detached a new thread.
2. You've created a loop that creates lots of objects and want to collect garbage every now and then.
3. You're in the main thread and never call NSApplicationMain().


Nick Zitzmann
<http://www.chronosnet.com/>


_______________________________________________

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: Tim Davis <email@hidden>
References: 
 >Autorelease/Retain/Release (From: Tim Davis <email@hidden>)

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