title: iPhone NSMutableArray Memory Leak
body: <p>Xcode Instruments claims that the below code results in memory leak. As far as I understand, the following happens when assigning a property:<br>
  * The old value is autoreleased<br>
  * The new value is retained<br>
  * The new value is assigned obviously<br>
  With that it mind, how come I have a memory leak and how do I resolve it?  </p>
  
  <p>"TestProjectViewController.h":  </p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @interface TestProjectViewController : UIViewController {
      NSMutableArray* array;
  }
  
  @property (nonatomic, retain) NSMutableArray* array;
  
  @end
  </code></pre>
  
  <p>"TestProjectViewController.m":  </p>
  
  <pre><code>#import "TestProjectViewController.h"
  
  @implementation TestProjectViewController
  
  @synthesize array;
  
  - (void)applicationDidFinishLaunching:(UIApplication *)application {    
      for(int i = 0; i &lt; 5; i++) {
          self.array = [[NSMutableArray alloc] init];
          [self.array addObject:@"Hello world #1"];
          [self.array addObject:@"Hello world #2"];
      }
  }
  </code></pre>