Re: Analyser reports memory leak… where?
Re: Analyser reports memory leak… where?
- Subject: Re: Analyser reports memory leak… where?
- From: Lee Ann Rucker <email@hidden>
- Date: Thu, 12 Sep 2013 14:25:06 -0700
On Sep 12, 2013, at 1:49 PM, Greg Parker wrote:
> 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.
Ooh, yes, that works great!
So many new language features, so little time...
_______________________________________________
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