Re: I don't understand why this is leaking...
Re: I don't understand why this is leaking...
- Subject: Re: I don't understand why this is leaking...
- From: Jean-Daniel Dupas <email@hidden>
- Date: Sun, 10 Aug 2008 10:27:46 +0200
Le 10 août 08 à 00:48, Cate Tony a écrit :
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.
MallocDebug is not the best tool to debug Obj-C memory eaks. You
should use ObjectAlloc instead (an Instrument probe).
_______________________________________________
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