So I have a question about auto-release pool. I created one use it as following:
dispatch_async(dispatch_get_main_queue(), ^{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSMutableAttributedString * attributedString = [NSMutableAttributedString attributedStringWithString:object.text];
[attributedString setFont:[UIFont fontWithName:@"HelveticaNeue" size:15]];
[self.titleLabel_ setAttributedString:attributedString];
[self.titleLabel_ setLinkColor:self.textColor_];
[self parseTagsInComment];
[pool release];
});
Is this a wrong use of an auto-release pool because I already have an auto-released object?
YES this is right. All the
autoreleasedobjects within thepoolwill getreleasemessage after[pool release];Thus flushed from the memory if their retain count becomes
0as in your caseNSMutableAttributedStringandUIFontwill be released.