Suggestions for debugging “EXC_BAD_ACCESS” - followup
Suggestions for debugging “EXC_BAD_ACCESS” - followup
- Subject: Suggestions for debugging “EXC_BAD_ACCESS” - followup
- From: Bob Barnes <email@hidden>
- Date: Tue, 29 Sep 2009 15:18:36 -0700
all,
I wanted to follow up my email from last week with some additional
questions about the leaks instrument and what it is or isn't trying to
tell me. When running the leaks instrument with NSZombieEnabled
several lines of the following code are flagged as leaked memory...
NSString *filename;
NSString *keyString;
NSString *descriptionFilename;
NSString *description;
NSDictionary *descriptionDictionary;
NSData *descriptionData;
NSFileHandle *descriptionFile;
const char *buffer;
filename = [path stringByAppendingPathComponent:file];
buffer = [filename cStringUsingEncoding:NSUTF8StringEncoding];
keyString = [[filename lastPathComponent]
stringByDeletingPathExtension];
descriptionFilename = [keyString
stringByAppendingPathExtension:@"desc"];
descriptionFile = [NSFileHandle fileHandleForReadingAtPath:[path
stringByAppendingPathComponent:descriptionFilename]];
if(descriptionFile != nil) {
descriptionData = [descriptionFile readDataToEndOfFile];
description = [[NSString alloc] initWithData:descriptionData
encoding:NSUTF8StringEncoding];
descriptionDictionary = [description
propertyListFromStringsFileFormat];
[descriptionFile closeFile];
[description release];
}
Nearly every NSString* as well as the NSDictionary*, NSData* and
NSFileHandle* are flagged as memory leaks despite the fact that the
only object created with alloc, new or something with 'copy' in it is
the NSString* description, which I do release. Note that leaks
identifies it as a leak as well. Am I misinterpreting the leaks output
or am I still missing something fundamental?
tia,
Bob
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden