title: Returning an NSMutableArray from a method...do I release it prior? - iPhone SDK
body: <p>I have been very confused on how to handle the releasing of an NSMutableArray when I need to return it from a method. I am not even sure if I am suppose to release it or not.</p>
  
  <p>I have the code:</p>
  
  <pre><code>-(NSArray *)methodToCall {
  
          NSMutableArray *mutArray = [[NSMutableArray alloc] initWithCapacity:10];
  
          //Fill the array with stuff here
  
          [mutArray release];  //Am I suppose to have this to keep the memory down?
          return mutArray;
  }
  </code></pre>
  
  <p>My question is whether or not I am suppose to have the <code>[mutArray release];</code> in the code or not. Could someone explain this? I am at a loss and I want to keep my code as clean and leak free as possible.</p>