Re: ARC Retain Cycles
Re: ARC Retain Cycles
- Subject: Re: ARC Retain Cycles
- From: Dave <email@hidden>
- Date: Mon, 21 Apr 2014 17:07:15 +0100
On 21 Apr 2014, at 15:53, Keary Suska <email@hidden> wrote:
> On Apr 21, 2014, at 8:12 AM, Dave wrote:
>
>> @property (nonatomic,retain) id payloadObject;
>>
>> This is after I ARCed it, before that it didn’t specify it, e.g. it was (nonatomic). I must have made it retain when I was going through the properties. I’m not sure what the default is? I assume it must have been assign for this to work originally. I did a google for this and found conflicting results, according to the Objective-C Reference Manial, it’s assign. But I’m not sure where the “Offical” Objective-C manual is located to get it from the source.
>>
>> payloadObject is just used to hold a copy of the object to pass to the delegate method
>>
>>
>> After changing this, the leaks when down by a massive factor. Basically it was hanging onto *every* response from the server!
>>
>> I’m about to look through the code and see if I’ve made a similar mistake elsewhere.
>>
>> There are still a few more small leaks which I’m looking at now, but this is the mainstay - thanks again!
>
> I find this a somewhat confusing and non-inutitive issue with ARC--"strong" is the default under ARC, vs. "assign" in non-ARC. This can be a tricky issue when converting MRR projects.
Agreed! I assumed that leaving off the default for this attribute would be retain, whereas in fact it must have been assign when it was originally written. I think that this is SUCH an important aspect that it give a warning if it’s not specified explicitly. I’d also promote that one to an error!
Cheers
Dave
_______________________________________________
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