title: How to release the elements of an NSArray, loaded by arrayWithContentsOfURL?
body: <p>I am too dumb to know the answer to this one - does anyone know the answer definitively?</p>
  
  <pre><code>NSMutableArray *happyDictionaryEntries;
  @property (nonatomic, retain) NSMutableArray *happyDictionaryEntries;
  
  -(void) getStuffFromServer
   {
   ..
   self.happyDictionaryEntries = [NSMutableArray
    arrayWithContentsOfURL:[NSURL URLWithString:aUrl]];
   }
  </code></pre>
  
  <p>Later we will release the array. I want to actually release all the elements of the array.</p>
  
  <p>So, we would [happyDictionaryEntries release].</p>
  
  <p>(Or I suppose just self.happyDictionaryEntries = nil since it's a property.)</p>
  
  <p>BUT do you also have to [happyDictionaryEntries removeAllObjects] ?</p>
  
  <p>AND/OR do you have to release each item in the array manually?</p>
  
  <p>(Indeed - associated question - does anyone know if removeAllObjects in fact releases each object?  It's not really clear what the situation is.) Is there an idiom?</p>
  
  <p>I can manage memory no problem in a typical array that you build up "yourself", but I'm too dumb to understand what the situation is when you have arrayWithContentsOfURL in the mix.  If anyone definitively knows the answer, thanks!</p>
  
  <p>"The documentation for NSArray &amp; NSMutableArray state the memory management behavior - Joshua"</p>
  
  <p>Correct. Do you have any documentation for removeAllObjects or for arrayWithContentsOfURL? Can anyone decisively state what removeAllObjects does?  Thanks.</p>
  
  <p>"From Apple's Memory Management Programming Guide: [well-known quite form the doco]"-jlehr.</p>
  
  <p>Correct, but what does removeAllObjects do? Does anyone know?</p>
  
  <p>NOTE THAT <strong><em>there is NO documentation on that</em></strong>.  The doc on NSMutableDisctionary removeAllObjects for example <strong><em>IS explicit</em></strong>. BUT the doc on NSMutableArray removeAllObjects noticably <strong><em>SAYS NOTHING</em></strong>.  It could be like (to make one example) imageNamed which basically doesn't work and does not work as one would expect.</p>