On Wed, Sep 17, 2008 at 12:13 PM, Jamie Hardt <[EMAIL PROTECTED]> wrote: > Hello- > > I don't thin you can call dictionaryWithObject: without having an > autorelease pool set up, and initialize might be getting called before > autorelease pool for the main loop is getting setup. Try replacing > dictionaryWithObject: with a standard alloc-init sequence.
You will never crash due to not having an autorelease pool around, only log errors and leak. (An exception to this is, of course, if the leaking causes you to run out of memory and crash.) However, it should be noted that you must *always* have an autorelease pool around any time you call into an Objective-C framework whose code you do not fully control. Even doing an alloc/init with an NSDictionary could, at least in theory, autorelease objects while doing its work. If you call Cocoa from a context where it's not certain that an autorelease pool has already been provided (such as this), then you should always create your own. But don't sweat it if you've forgotten it for an +initialize method. Since they get run only once (or rather, at most only a few times if you have subclasses) any potential leaks from this scenario won't be very serious, and will be easy to track down if they ever start happening. Mike _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]