Reputation: 38940
What is the difference between [NSMutableArray array]
and [[NSMutableArray alloc] init]
?
Upvotes: 0
Views: 383
Reputation: 9040
[NSMutableArray array]
returns an autoreleased array.
[[NSMutableArray alloc] init]
returns a retained array.
You don't own the autoreleased array, so you don't have to release it. You own the retained one (with alloc), so you have to release it.
Upvotes: 2
Reputation: 135548
[NSMutableArray array]
is equivalent to [[[NSMutableArray alloc] init] autorelease]
.
Upvotes: 3