title: Cocoa Touch: Accessor method + memory needs clarification
body: <p>Please consider a problem constructing an array and returning it to a parent object. Please have a look at my code and comments below. </p>
  
  <p><strong>My question is: Why does method THREE work while methods ONE and TWO do not?</strong></p>
  
  <pre><code>// ****************************
  // Master.m
  // ****************************
  
  // Simply declare array and call accessor
  NSMutableArray * allElementTypes;
  allElementTypes = [ElementObject badElements];
  
  
  
  
  // ****************************
  // ElementObject.m
  // ****************************
  
  // Doesn't work (EXE_BAD_ACCESS)
  + (NSMutableArray*) badElements {
      NSMutableArray * array = [[NSMutableArray alloc] initWithObjects:@"crab", @"poison", @"snake"];
      return array;
  }
  
  // Doesn't work (EXE_BAD_ACCESS)
  + (NSMutableArray*) badElements {
      return [NSMutableArray arrayWithObjects:@"crab", @"poison", @"snake"];
  }
  
  // WORKS
  + (NSMutableArray*) badElements {
      NSMutableArray * array = [[NSMutableArray alloc] init];
          [array addObject:@"crab"];
          [array addObject:@"poison"];
          [array addObject:@"snake"];
  
      return array;   // TODO: release this memory
  }
  </code></pre>