0
我試圖理解自動釋放池。我創建了一個示例應用程序如下:
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]);
的最近的記錄仍然打印retaincount爲1 我缺少的東西...有人可以幫助我瞭解....
謝謝...
http://whentouseretaincount.com – bbum 2012-08-11 14:18:35
請你幫個忙,並使用ARC的dealloc。它現在是默認設置,幾乎適用於所有人。 – 2012-08-11 18:54:33