title: NSString memory leak?
body: <p>I'm turning around and around with the following code giving me a memroy leak in the pics object apparently linke to the object imageName.</p>
  
  <pre><code>for (int i = 0;i&lt;[potatoesIndexesArray count];i++){ 
  
      int imageNumber = [[potatoesIndexesArray objectAtIndex:i]intValue];
  
      NSString *imageName = [[NSString alloc] initWithFormat:@"texture%d",imageNumber];
  
      UIImage *image = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:imageName ofType:@"png"]];
      //UIImage *imageHighlighted = [[UIImage alloc]initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:imageName ofType:@"png"]];
  
      NSArray *pics = [[NSArray alloc] initWithObjects:
                       [self maskImage:image withMask:[mainDelegate.masksArray objectAtIndex:i]],
                       [self maskImage:image withMask:[mainDelegate.masksArray objectAtIndex:i]],
                       imageName, 
                        nil]; // pics becomes owner of objects
  
      [textures addObject:[pics retain]]; //textures becomes owner of pics. as a release occurs later. we must retaint pics to keep it available in textures.
  
      [imageName release];
      [image release];
      [pics release];
  
      //[imageHighlighted release];
  
  }
  </code></pre>
  
  <p>I've read the Apple doc on memory management bu I can't find what I did wrong there ... any idea ??</p>
  
  <p>Cheers,</p>
  
  <p>Tibi.</p>