I don't understand why this is leaking...
I don't understand why this is leaking...
- Subject: I don't understand why this is leaking...
- From: Cate Tony <email@hidden>
- Date: Sat, 09 Aug 2008 17:48:42 -0500
This code is leaking:
- (void)saveItemExtensions:(id)sender
{
NSMutableString* itemExtensionsFilePath = [NSMutableString
stringWithString:@"~/Library/Preferences/MyApp/extensions.abc"];
NSDictionary* extensions = [NSDictionary dictionaryWithDictionary:
[itemDataSource itemExtensions]];
[itemExtensionsFilePath setString:[itemExtensionsFilePath
stringByExpandingTildeInPath]];
[[NSArchiver archivedDataWithRootObject:extensions]
itemExtensionsFilePath atomically: YES];
}
- (void)encodeWithCoder:(NSCoder *)coder
{
[coder encodeObject: string1];
[coder encodeObject: string2];
[coder encodeObject: string3];
[coder encodeObject: string4];
[coder encodeObject: string5];
[coder encodeObject: string6];
[coder encodeObject: string7];
[coder encodeObject: string8];
}
According to MallocDebug, the leak is in the encodeWithCoder method.
Things I've tried:
1 [coder encodeObject: [string1 autorelease]]; Which, of course,
caused a crash
2 [coder encodeObject: [string1 copy]]; no diff
3 [coder encodeObject: [[string1 copy] autorelease]]; no diff
4 Drinking beer...
Can anyone explain this to me?
Tony
_______________________________________________
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