-(NSMutableArray *)processResult:(NSArray*)matchArray
removeString:(NSString *)removeStr{
NSString *newLink;
NSMutableArray *result = [[NSMutableArray alloc] initWithCapacity:[matchArray count]];
//doing sth to result
return result;
}
In this scenario, as the result variable will be returned to the caller. And the caller will use this variable through the life time of the app. Is there any way to free the created in this method?
Go with the memory management guide-lines, return an auto-released instance:
That way the caller can decide wether he wants to take ownership or not.
Per the guide-lines, the naming implies what the method returns:
For your method-name this doesn’t apply, thus an auto-released instance should be returned.