Reputation: 508
An array has contains multiple objects.If we call removeAllObjects method, Whether objects will be released which in an array or we have release manually.
Upvotes: 0
Views: 389
Reputation: 19469
You should do this to release your array. Better to release it this way rather than autoreleasing the array
[YourArray release];
YourArray = nil;
If you just want to get rid of the data and dont want to release the array then you can simply do:
YourArray = nil;
It is better to release array using [YourArray release]
statement then declaring it as autorelease
in declaration.
Hope this helps you.
Upvotes: 0
Reputation: 31720
You shouldn't need to remove all objects before you release. When an NSMutableArray is dealloc'd, it releases all of the objects in contains automatically.
More click here
Upvotes: 0
Reputation: 724142
Sending an NSArray
that message will cause it to release all its pointers. You don't need to release what you put in there yourself, unless you have your own pointers to those objects elsewhere.
Upvotes: 3