Working in Objective C here. Suppose I have an array named fooArray. Each element in this fooArray is an object…we’ll call them barObject1, barObject2, barObject3, etc. Now each of these objects has several properties which are taking up memory. Now, imagine that I clear out one of these objects from fooArray using something to the extent of:
[fooArray removeObjectAtIndex:0]
Now, does this actually delete the object? Or does it merely take it out of the array, leaving the object and its properties to float around in memory?
This isn’t directly related to any project I’m working on, just simply trying to understand how it’s working.
thanks!
An array retains the objects it contains. Removing the object from the array will call
releaseon the object. Then, if the object has a retain count of0, it will be deallocated.