Programatically detect if any autorelease pool exists?
Programatically detect if any autorelease pool exists?
- Subject: Programatically detect if any autorelease pool exists?
- From: "Sean McBride" <email@hidden>
- Date: Tue, 5 Sep 2006 15:38:02 -0400
- Organization: Rogue Research
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:
This email sent to email@hidden