Reputation: 4699
If I have a grandfather object that contains an array of parent objects that contains an array of children objects. Assuming I have released the objects after adding them to the arrays, how do I go about releasing all the objects? Can I just call removeallobjects on the grandfather object? When I do this I get a leak :(
Thanks
Upvotes: 0
Views: 154
Reputation: 54425
Simply call release
on the "grandfather" object - it'll then release the "parent" objects, who will release the "children" objects, etc. all the way down. (Or "up" depending on how you look at it.)
In essence when you release an NS(Mutable)Array, it'll release the objects it has pointers to - if those objects happen to be NS(Mutable)Arrays, they'll therefore release the objects they have pointers to...
Upvotes: 2