In short, I need to know if I am able to log the storage type for a variable.
Specifically, I want to log whether a variable has the __block
storage type modifier applied to it.
Ideally, I'm looking for something like:
NSLog(@"storage type: %@", [localVar storageType]);
In case you're wondering, I think I just figured out a memory leak I've been debugging for the past few days, and I want to test if my assumption is correct.
I'm using ASIHttpRequest with setCompletionBlock
and setFailedBlock
, but I'm passing my request object to a convenience method that does the actual setup of the blocks, like so:
- (void)getAllHighlights:success:(ASIBasicBlockWrapper)cb1 fail:(ASIBasicBlockWrapperFail)cb2{
// blah blah blah
__block ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setRequestMethod:@"GET"];
[request setDelegate:self];
[self executeAsynchronousRequest:request onSuccess:cb1 onFail:cb2];
}
Then, executeAsynchronousRequest
sets up the Blocks and starts the request:
- (void) executeAsynchronousRequest:(ASIFormDataRequest *)request onSuccess:(ASIBasicBlockWrapper)cb1 onFail:(ASIBasicBlockWrapperFail)cb2
{
[request setCompletionBlock:^{
int statusCode = [safeRequest responseStatusCode];
NSString *statusMessage = [self statusErrorMessage:statusCode];
cb1([safeRequest responseString],statusMessage);
}];
[request setFailedBlock:^{
cb2(safeRequest);
}];
[request startAsynchronous];
}
My hunch tells me that even though I set up my request object as __block ASIFormDataRequest *request
, when it's used within executeAsynchronousRequest
, it's lost the __block storage type since it has only been typed as (ASIFormDataRequest *)request
.
Thanks!