Re: NSReleasePool issue
Re: NSReleasePool issue
- Subject: Re: NSReleasePool issue
- From: Varun Chandramohan <email@hidden>
- Date: Sun, 22 Jun 2014 23:00:52 +0000
- Thread-topic: NSReleasePool issue
I agree on the fact that if the auto pool is introduced in main then its going to mask all the leaks in other parts of the code leading to unknown memory leaks. I see a divided option on this, but in OSX world this should be taken care by OS itself. Perhaps I will report this to Apple and see what they have to say. Does anyone know where to report the issue?
Regards,
Varun
From: Jens Alfke <email@hidden<mailto:email@hidden>>
Date: Sunday, 22 June 2014 5:24 am
To: Kyle Sluder <email@hidden<mailto:email@hidden>>
Cc: Development <email@hidden<mailto:email@hidden>>, Cocoa-Dev List <email@hidden<mailto:email@hidden>>
Subject: Re: NSReleasePool issue
On Jun 21, 2014, at 11:16 AM, Kyle Sluder <email@hidden<mailto: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