• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: ARC Retain Cycles
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ARC Retain Cycles


  • Subject: Re: ARC Retain Cycles
  • From: Dave <email@hidden>
  • Date: Mon, 21 Apr 2014 13:27:37 +0100

On 21 Apr 2014, at 12:04, Roland King <email@hidden> wrote:

>
> On 21 Apr, 2014, at 6:45 pm, Dave <email@hidden> wrote:
>
>>
>> It does use isKindOfClass, I wasn’t trying to be 100% correct on the fluff, just showing giving an example of the type of thing going in in property assignment.
>>
>> I didn’t write that part it was like that and by all account it sort of worked.
>>
>> I may just revert back to the non-ARC version do manual Memory Management as ARC seems very difficult to debug, especially since you can’t get at things like “retainCount” or override “retain”, “release” etc.
>>
>
> It's not really hard to debug, it's just different. retainCount never was a very good indicator of what was going on anyway. I really do suggest using Instruments, that even pairs up retains and releases for you in the detailed logging so you can often figure out what the dangling one is.

I’ll have a look, because it is a bit of a retrograde step to get rid of ARC now that I’ve gone to all the trouble of converting it.

I found using retainCount in conduction with some overrides worked wonderfully for me, but I’ll have a go using instruments. One of the things that I can’t seem change is that whenever I run the Profile, it selects an iPad retina instead of a normal iPad which takes up the while screen. I’ll have another go and try to get it to work on the normal iPad.

Here is an extract of one of the methods I suspect of being the root cause. I’m wondering if something is wrong with the wat the Code Block works. I haven’t changed that bit, just made it ARC (which is why you will see some releases commented out). Also, when I did this, I left the property attributes as “retain” and “assign”, I’m wondering if it would be better to change them to “strong” and “weak” ? Although, AFAIK this shouldn’t make a difference?

-(JMNetworkCommandResponse*) executeSyncRequestWithParameters:(JMNetworkRequestParams*) theRequestParameters
{
JMNetworkCommandResponse*				myNetworkResponse;
long										myTimeOutStatus;
dispatch_group_t							myDispatchGroup;
NSURL*									myURL;
NSMutableURLRequest*						myURLRequest;
NSURLSessionDataTask*					myDataTask;
NSString*									myParameterString;
NSData*									myBodyData;
JMNetworkRequestHTTPDataMethod			myTransferMethod;
JMNetworkOperationiOS7*					myNetworkOperation;

myURL = [[NSURL alloc] initWithString:theRequestParameters.pRequestURLString];
if (myURL == nil)
	return nil;

myNetworkOperation = [self newOperationWithRequestParameters:theRequestParameters];

myDispatchGroup = dispatch_group_create();
dispatch_group_enter(myDispatchGroup);

myDataTask = [self.pNetworkCommandURLSession dataTaskWithURL:myURL completionHandler:^(NSData* theResponseData,NSURLResponse* theURLResponse,NSError* theErrorInfo)
	{
	JMNetworkCommandResponse*			myNewNetworkResponse;
	NSHTTPURLResponse*					myHTTPURLResponse;
	NSInteger							myHTTPStatus;

	myHTTPURLResponse = (NSHTTPURLResponse*) theURLResponse;
	myHTTPStatus = myHTTPURLResponse.statusCode;

	myNewNetworkResponse = [self newNetworkResponseWithRequestParameters:theRequestParameters andURLResponse:theURLResponse andResponseData:theResponseData andErrorInfo:theErrorInfo];
	[self setNetworkResponse:myNewNetworkResponse withRequestID:theRequestParameters.pRequestID];

	[myNetworkOperation.pResponseNetworkDelegate performDelegateSelectorOnMainThreadWithObject:myNewNetworkResponse];

	dispatch_group_leave(myDispatchGroup);
	}
	];

[myDataTask resume];

//	dispatch_release(myDispatchGroup);

//**
//**	Extract the Response from the Dictionary and Reset the Request
//**
myNetworkResponse = [self getNetworkResponseWithRequestID:theRequestParameters.pRequestID];
[self removeNetworkResponseWithRequestID:theRequestParameters.pRequestID];

return myNetworkResponse;
}


Thanks a lot
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


  • Follow-Ups:
    • Re: ARC Retain Cycles
      • From: Andy Lee <email@hidden>
    • Re: ARC Retain Cycles
      • From: Roland King <email@hidden>
References: 
 >ARC Retain Cycles (From: Dave <email@hidden>)
 >Re: ARC Retain Cycles (From: Cody Garvin <email@hidden>)
 >Re: ARC Retain Cycles (From: Quincey Morris <email@hidden>)
 >Re: ARC Retain Cycles (From: Dave <email@hidden>)
 >Re: ARC Retain Cycles (From: Quincey Morris <email@hidden>)
 >Re: ARC Retain Cycles (From: Dave <email@hidden>)
 >Re: ARC Retain Cycles (From: Roland King <email@hidden>)

  • Prev by Date: Re: ARC Retain Cycles
  • Next by Date: Re: ARC Retain Cycles
  • Previous by thread: Re: ARC Retain Cycles
  • Next by thread: Re: ARC Retain Cycles
  • Index(es):
    • Date
    • Thread