title: Can't figure out where memory leak comes from
body: <p>I'm somewhat of a cocoa newbie and I simply can't figure out why I'm getting a spike in the leaks graph in Instruments with this code. It seems to be a small leak (i.e. 16 Bytes and the Leaked Object is "Generalblock-16"; that is the only leaking object and says Self 100%) and it seems to remain that size regardless of whether I choose just 1 file or 12,000 files. I've double-clicked on every line of the Stack Trace shown in the Extended Detail view of Instruments and it doesn't lead me to any line in my code.</p>
  
  <p>Thanks in advance for any help you can give me with this.</p>
  
  <p>Y.V.</p>
  
  <p>P.S.: In case there's nothing wrong with my code (which I doubt) and the leak is simply a bug or something unrelated to my code, is it safe to use this code as it is? Will it bring about instability to my app or make crash or anything like that?</p>
  
  <pre><code>@implementation AppController
  
  -(IBAction)openTheOpenPanel:(id)sender
  {
      NSOpenPanel *openThePanel = [NSOpenPanel openPanel];
      [openThePanel setAllowsMultipleSelection:YES];
  
      if([openThePanel runModal] == NSOKButton)
      {
          NSArray *allTheFiles = [openThePanel filenames];    
  
          int theNumberOfFiles = [allTheFiles count];
  
          int i;
  
          NSMutableDictionary * theDict;
          theDict = [[NSMutableDictionary alloc] init];
  
          for (i=0; i &lt; theNumberOfFiles; i++) {
              NSString *thisFile = [allTheFiles objectAtIndex:i];
              NSString *theFileNum = [NSString stringWithFormat:@"%i", i];
  
              [theDict setObject:thisFile forKey:theFileNum]; 
          }
  
          [theDict writeToFile:@"/tmp/test_file.txt" atomically:YES];
  
          [theDict release];
      }
  }
  
  @end
  </code></pre>