Re: Analyser reports memory leak… where?
Re: Analyser reports memory leak… where?
- Subject: Re: Analyser reports memory leak… where?
- From: Greg Parker <email@hidden>
- Date: Thu, 12 Sep 2013 13:49:32 -0700
On Sep 12, 2013, at 1:45 PM, Lee Ann Rucker <email@hidden> wrote:
> On Sep 12, 2013, at 9:57 AM, Bill Cheeseman wrote:
>> As I recall, it stated that the "return [[x retain] autorelease]" pattern is preferred for getters and gave many reasons for preferring it.
>
> Coincidentally enough, we've just hit a case where that's bad - it's a complicated situation with ObjC++ and C++ object lifetimes, resulting in an accessor that uses that pattern being called as a result of that object being in dealloc. By the time the autorelease pool pops the object it's trying to release is long gone. It's KVO unregistering, so there's not much we can do about it other than be smarter in our accessors.
In some cases you can add an @autoreleasepool inside the object's -dealloc method to catch these.
--
Greg Parker email@hidden Runtime Wrangler
_______________________________________________
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