重複の可能性:
allocとallocWithZoneの違いは何ですか?
allocWithZone
オブジェクト自体に近いメモリ位置を使用することでパフォーマンスを向上させるのに役立つという記事を読みました。これは本当ですか?allocWithZone
の代わりに使用することをお勧めしますalloc
か?allocとallocWithZoneの違いは何ですか?
証明された例は次のとおりです。
- (id)init
{
if (self = [super init])
{
_myString = [[NSString allocWithZone:[self zone] init]];
}
return self;
}