title: how to clear an NSMutableArray of custom objects without creating memory leaks?
body: <p>If I have an NSMutableArray of custom objects, how can I must easily clear the array without causing any memory issues?   Assume that the custom object class has a dealloc method in it which correctly released an instance variables etc.</p>
  
  <p>For example is it ok to use the NSArray "removeAllObjects" method? </p>
  
  <ul>
  <li><p>If yes - how does this work - does "removeAllObjects" call the "dealloc" method on each object as it removes them</p></li>
  <li><p>If no - what would be the easiest approach to use?  </p></li>
  </ul>
  
  <p><strong>EDIT (after 4 replies)</strong> - One last question of clarification after the great replies - I'm still not quite sure about the instance variables/properties in my custom object that I have set to retain?  These seem to be only released via the the "dealloc" method in my custom object class, where we do this manually along with [super release].    </p>
  
  <p>So if, re clearing an array, if I do a removeAllObjects, and then NSArray issues a "release" to my custom objects, but doesn't call "dealloc", then how do my instance variables get released?  </p>