Re: ARC Retain Cycles
Re: ARC Retain Cycles
- Subject: Re: ARC Retain Cycles
- From: Dave <email@hidden>
- Date: Fri, 25 Apr 2014 02:24:18 +0100
On a more positive note, thanks to yours and others help, I’ve sorted my Memory issues.
I got rid of the leaks (most if not all!), after that running a download test, showed that memory peaked at 150+ MB.
After fishing about and changing every method in the call chain to conform to new/alloc naming, I got it to peak at 120ish MB.
After digging and moving @autoreleasepool’s down the call chain until I reach the bottom later and there was the 120 MB culprit!
myDataTask = [self.pNetworkCommandURLSession dataTaskWithURL:myURL completionHandler:
^(NSData* theResponseData,NSURLResponse* theURLResponse,NSError* theErrorInfo)
{
LTWiOS7NetworkInfo* myBlockiOS7NetworkInfo;
myBlockiOS7NetworkInfo = [[LTWiOS7NetworkInfo alloc] initWithResponseData:theResponseData andHTTPURLResponse:(NSHTTPURLResponse*) theURLResponse andErrorInfo:theErrorInfo];
[self setNetworkResponse:myBlockiOS7NetworkInfo withRequestID:theRequestParameters.pRequestID];
}
];
Returns autoreleased theResponseData and/or theURLResponse and/or theErrorInfo. These values are copied into properties with +1 retain count and passed up the chain. This was all working fine and those copies were getting released, it was the 3 autorelease objects from passed back in dataTaskWithURL: that were stuck in the autorelease pool.
I just out a @autoreleasepool {} around the whole method and now when I run the same tests, the memory peaks at…………….. Wait for it……………. 12 MB!
That’s 110 MB difference! Amazing! I always knew autorelease was bad news!
Thanks again for your help!
Cheers
Dave
On 25 Apr 2014, at 00:09, Roland King <email@hidden> wrote:
> "Engineering has determined that your bug report (16683382) is a duplicate of another issue (10109782) and will be closed."
>
> .. that wasn't very worthwhile was it.
>
> On 22 Apr, 2014, at 12:49 pm, Roland King <email@hidden> wrote:
_______________________________________________
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