Re: Programatically detect if any autorelease pool exists?
Re: Programatically detect if any autorelease pool exists?
- Subject: Re: Programatically detect if any autorelease pool exists?
- From: John Stiles <email@hidden>
- Date: Tue, 5 Sep 2006 13:21:57 -0700
Weird... how, specifically, is creating an NSAutoreleasePool causing
problems with Cocoa apps? If you always release your pool before
returning control to the caller, it seems like you ought to be safe.
On Sep 5, 2006, at 12:38 PM, Sean McBride wrote:
Hi all!
Is there a way to programatically detect if any autorelease pool
exists?
Why? I'm helping with a cross-platform open source library (vtk, if
you're curious) and I'm having a problem with autorelease pools. The
library is C++ only (there are a few Obj-C++ classes, but that's an
internal implementation detail) and tends to be used in one of two
ways:
in a cross-platform C++ app, or in a normal Cocoa application.
Currently, the library is creating its own NSAutoreleasePool then
releasing it later. This works great in the first case (since cross
platform C++ apps should not be concerned with the fact that the
library's implementation needs an autorelease pool present) but is
problematic in the second case.
So what I'd like is for the library's code to be able to detect if no
autorelease pool exists, and only create one if that is the case.
I had
hoped that calling NSApplicationLoad() would create an autorelease
pool,
but that doesn't seem to be the case.
Thanks for any help!
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40blizzard.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden