Objective-c NSMutableArray release behaviour

objective-c

Solution

Yes it does. It retains them when added, and releases them when dealloc'd. This is actually one of the most common questions I see here.

Problem

Does the release, recursively releases all inner objects? or must it be done manualy? Can I do just this? ``` NSMutableArray *list = [[NSArray alloc] init]; // ... // fill list with elements //... [list release]; ``` Or must I release all inner objects one by one before releasing the NSMutableArray? // Suposing there isn't any other reference to the contained objects, except on the list itself.

Original source