What is the differece between:
[[NSMutableArray alloc] init]
and
[NSMutableArray array]
What is the differece between:
[[NSMutableArray alloc] init]
and
[NSMutableArray array]
Here in [NSMutableArray array] you don't have to release array it will be released automatically. & if you will write [NSMutableArray alloc] init] you will have to release array so [[NSMutableArray array] will be equivalent to [[[NSArray alloc] init] autorelease];
The first remains in memory until you release it, the second lasts until the end of the run loop iteration.
NSMutableArray no need to release memory and [NSMutableArray alloc] init] u must be release it.
when ARC does work, you have to release objects come from methods including init,alloc,new,copy and mutableCopy, like [NSMutableArray alloc] init]. If not, the objects will be registered to autoreleasepool, like [NSMutableArray array].