If I have an autoreleased object, when does its retain count (i.e. the value returned when I call the method retainCount on it) decrement? I had figured it to be when the scope of the method the object was allocated within ended, but my tests aren't indicating that. I have code like the following:
int itemIndex = 0;
NSArray* items = [mResponse componentsSeparatedByString:@","];
self.mText = (NSString*)[items objectAtIndex:itemIndex++];
self.mText = [mText gtm_stringByUnescapingFromURLArgument];
NSLog(@"retain count: %d",[mText retainCount]);
This returns 2 for the count (mText has a retain property so that makes sense), and after exiting this method, the call from outside likewise returns 2.