Non-alloc/copy Methods
+ (NSMutableString *)string
{
return [[[self alloc] init] autorelease];
}
Let’s revisit why you don’t have to release objects from non-alloc or
copy methods
NSMutableString *theString = [NSMutableString string];
// You don’t have to release theString because you didn’t
// alloc or copy it
本文探讨了Objective-C中非alloc或copy方法的使用,解释了为什么从这些方法中获取的对象不需要显式释放。通过一个NSMutableString的例子说明了内存管理的具体实践。

被折叠的 条评论
为什么被折叠?



