Re: NSReleasePool issue
Re: NSReleasePool issue
- Subject: Re: NSReleasePool issue
- From: Jens Alfke <email@hidden>
- Date: Sat, 21 Jun 2014 12:24:31 -0700
On Jun 21, 2014, at 11:16 AM, Kyle Sluder <email@hidden> wrote:
> The pool will never be drained, because NSApplicationMain never returns. There is no wasted work here.
But it’s still true that any object autoreleased into that pool is effectively leaked. It just won’t be visible as such to the ‘leaks’ tool or Instruments, because technically that outer autorelease pool still has a reference to it. Nor will you be able to get that warning about an object being autoreleased without a pool, which is another way to catch such a leak. So it seems that all this does is hide potential leaks from you.
> 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.
Any code that runs at startup that uses autorelease should create its own temporary autorelease pool. There’s apparently one such routine that doesn’t: that’s the actual bug here, and as I said, it should be reported to Apple.
—Jens
_______________________________________________
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