As far as I know, creating an NSMutableArray
with a helper method such as arrayWithArray
adds both the array and the mutable array to the current autorelease pool. With mutableCopy
, the array being copied as added to the autorelease pool but the resulting NSMutableArray
does not. Without ARC, it's a notable difference.
But when using ARC, is there any difference beyond what is described above and which is irrelevant with ARC? I've seen code using both ways. Is there an established best practice on how to create mutable versions of immutable objects, when ARC is turned on, and why is it so?