¿Cuál es el differece entre:NSMutableArray alloc init vs arsenal NSMutableArray
[[NSMutableArray alloc] init]
y
[NSMutableArray array]
¿Cuál es el differece entre:NSMutableArray alloc init vs arsenal NSMutableArray
[[NSMutableArray alloc] init]
y
[NSMutableArray array]
Aquí en [NSMutableArray array]
no tiene que liberar array
se lanzará automáticamente. & si usted va a escribir [NSMutableArray alloc] init]
tendrá que liberar de manera array
[[NSMutableArray array]
será equivalente a [[[NSArray alloc] init] autorelease];
Los primeros restos en la memoria hasta que lo suelte, el segundo dura hasta el final del bucle de ejecución iteración.
NSMutableArray
hay necesidad de liberar la memoria y [NSMutableArray alloc] init]
u debe ser lo liberan.
cuando ARC funciona, debe liberar objetos que provienen de métodos que incluyen init, alloc, new, copy y mutableCopy, como [NSMutableArray alloc] init]. De lo contrario, los objetos se registrarán en autoreleasepool, como [NSMutableArray array].
posible duplicado de [Diferencia entre \ [NSMutableArray array \] vs \ [\ [NSMutableArray alloc \] init \]] (http://stackoverflow.com/questions/5423211/diference-between-nsmutablearray-array-vs -nsmutablearray-alloc-init) – kennytm