> On Jun 21, 2014, at 10:25 AM, Jens Alfke <[email protected]> wrote: > > >> On Jun 21, 2014, at 7:39 AM, Kyle Sluder <[email protected]> wrote: >> >> You should add the @autoreleasepool around NSApplicationMain. I don't know >> why it's missing from the Mac template. > > I disagree. It’s pointless to have an autorelease pool that won’t be drained > till the application quits.
The pool will never be drained, because NSApplicationMain never returns. There is no wasted work here. > Anything autoreleased into that pool will be effectively leaked, and draining > the pool on quit does nothing but slow down termination. > > The OP’s issue looks like an OS bug — there’s no application code on the > stack at the time of the autorelease. Should be reported to Apple. NSApplicationMain needs to interact with user defaults in order to parse the command line. It’s kind of unreasonable to expect Apple to eschew -autorelease in all code that can be called during startup. (I think the framework now even sets up an autorelease pool before calling +initialize methods. Not sure about +load.) Perhaps NSApplicationMain should set up its own autorelease pool. But that’s apparently not how the framework is implemented today. And as far as I can remember, developers have _always_ been responsible for setting up a backstop autoreleasepool. --Kyle Sluder _______________________________________________ Cocoa-dev mailing list ([email protected]) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
