Possible Duplicate:
When to use -retainCount?
I was trying to understand autorelease pools. I created a sample application as below:
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSString *releasePoolString = [[[NSString alloc] initWithFormat:@"%@",@"ReleasePool autorelease variable"] autorelease];
NSLog(@"Retain count of autorelease variable inside release pool %i",[releasePoolString retainCount]);
[pool drain];
// After pool drain still retain count = 1 ??????
NSLog(@"Retain count of autorelease variable after release pool drain %i",[releasePoolString retainCount]);
The last log still prints retaincount as 1. Am I missing something ... can someone please help me understand ....
Thanks...