【发布时间】:2011-11-16 03:10:35
【问题描述】:
我读到一篇文章提到使用allocWithZone 通过使用更接近对象本身的内存位置来帮助提高性能。这是真的?是否建议使用allocWithZone 而不是alloc? alloc 和 allocWithZone 有什么区别?
证明的例子是:
- (id)init
{
if (self = [super init])
{
_myString = [[NSString allocWithZone:[self zone] init]];
}
return self;
}
【问题讨论】:
标签: objective-c alloc