I will never be able to free my NSMutableString , as shown below. The initial hold value should be 1, but after releasing it several times, the string is still in use, as nothing happened!
#import <Foundation/Foundation.h> int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; // insert code here... NSMutableString* s = [[NSString alloc]initWithString:@"AAA"]; [s release]; [s release]; [s release]; [s release]; [s release]; NSLog(@"%@",s); [pool drain]; return 0; }
Of course, if I use Analyze, it still tells me that I release the selected object in the second release .
source share