Re: Autorelease question
Re: Autorelease question
- Subject: Re: Autorelease question
- From: Jens Alfke <email@hidden>
- Date: Fri, 4 Apr 2008 09:31:33 -0700
On 3 Apr '08, at 5:50 PM, Adam Leonard wrote:
If you are writing a tool that links with Foundation and not AppKit,
an autorelease pool is NOT created for you. As you saw in your first
example, you need to explicitly create and destroy one whenever you
are dealing with Foundation objects in a method.
It depends. At the outermost scope, like the main() method and things
called directly by it, you have to create your own pools. But if your
process uses NSRunLoop, that class ensures that everything it calls is
in the context of an autorelease pool. So you don't have to worry
about this when writing delegate/target methods for NSTimers,
NSURLConnections, etc.
Of course, it doesn't hurt to add your own anyway, if you want; it's
just a very small performance overhead.
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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