Re: Autorelease question
Re: Autorelease question
- Subject: Re: Autorelease question
- From: Chris Suter <email@hidden>
- Date: Fri, 4 Apr 2008 12:00:55 +1100
On 04/04/2008, at 11:47 AM, Jens Alfke wrote:
It's true that the very outermost pool on the main thread is created
in main();
I don't think that's normally the case. For a Cocoa application
created by the Xcode template, it won't create an autorelease pool for
you. Obviously, there won't be one created for you in the template for
a Carbon application.
I suspect the reason for the observed difference reported in the
original e-mail was because the code either wasn't running in the
Carbon application, or was running as part of the event loop—I believe
that an autorelease pool will be created for Carbon event loops.
To answer the original question: I don't think you can tell whether
there's an autorelease pool active. But it doesn't matter: if you're
doing anything that could autorelease objects, and there might not
be a pool already, create your own by calling [NSAutoreleasePool
new] beforehand and [pool drain] afterwards.
I think you mean [pool release], not [pool drain].
- Chris
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