• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: I don't understand why this is leaking...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >I don't understand why this is leaking... (From: Cate Tony <email@hidden>)

  • Prev by Date: Re: Custom URL Handling
  • Next by Date: Re: Does [NSApp setApplicationIconImage] leak memory?
  • Previous by thread: Re: I don't understand why this is leaking...
  • Next by thread: Re: I don't understand why this is leaking...
  • Index(es):
    • Date
    • Thread