• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSAutoreleasePool and static data member constructors
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >NSAutoreleasePool and static data member constructors (From: Erik Buck <email@hidden>)
 >Re: NSAutoreleasePool and static data member constructors (From: "Clark Cox" <email@hidden>)
 >Re: NSAutoreleasePool and static data member constructors (From: Uli Kusterer <email@hidden>)
 >Re: NSAutoreleasePool and static data member constructors (From: John Stiles <email@hidden>)

  • Prev by Date: Re: display int in cocoa
  • Next by Date: Re: NSAutoreleasePool and static data member constructors
  • Previous by thread: Re: NSAutoreleasePool and static data member constructors
  • Next by thread: Re: NSAutoreleasePool and static data member constructors
  • Index(es):
    • Date
    • Thread