Re: NSAutoreleasePool and static data member constructors
Re: NSAutoreleasePool and static data member constructors
- Subject: Re: NSAutoreleasePool and static data member constructors
- From: Uli Kusterer <email@hidden>
- Date: Thu, 11 Oct 2007 00:11:50 +0200
Am 10.10.2007 um 21:42 schrieb John Stiles:
a) use lazy initialization upon first use (go through an accessor
to get at a singleton, not use the global directly)
b) be darned careful to avoid circular dependencies
If b is not an option, one should at least do the initialization
after main() has been entered. Anything else just isn't safe or
reliable, nor deterministic enough. Once you've done that, you
have a function that gets called, and in that function you can set
up and tear down an autorelease pool for that one call. And as
with other uses of ObjC, any objects you need to keep around
yourself outside this pool should be retained.
Arrg... that should be: "If A is not an option"... what do we learn
from that? Never swap two items in a list without checking whether
that screws up references to them :-/
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
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