Hello everyone! 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. I've also tried different approaches in my code, but I just keep
getting the same leak.

Thanks in advance for any help you can give me with this.

Y.V.

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?



Here's the 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 < 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
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to