• 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: Newbie question - Leak in NSDictionary
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie question - Leak in NSDictionary


  • Subject: Re: Newbie question - Leak in NSDictionary
  • From: Thomas Lachand-Robert <email@hidden>
  • Date: Sun, 16 Mar 2003 16:39:55 +0100

Le dimanche, 16 mars 2003, ` 14:40 Europe/Paris, Andres Ramirez a icrit :

Hello. I seem to be missing an important concept, since this code is
leaking. The initial parts of the messages I get are pasted after
the code. As far as I can tell, the leak happens due to the
NSDictionary line.

fileAttributesAtPath returns an autoreleased dictionary: this implies that you need to have an autorelease pool in place. This is done for you automatically in the main thread of any AppKit based application, but if you are building a Foundation tool or using a new thread, you need to create a pool:
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
// now you can use fileAttributesAtPath, etc.
[pool release]; // don't forget to release the pool at the end

Thomas Lachand-Robert
********************** email@hidden
<< Et le chemin est long du projet ` la chose. >> Molihre, Tartuffe.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Newbie question - Leak in NSDictionary (From: Andres Ramirez <email@hidden>)

  • Prev by Date: Re: NSString array to -> char**
  • Next by Date: Re: NSRunLoop looping more than once?
  • Previous by thread: Newbie question - Leak in NSDictionary
  • Next by thread: Normal behavior?
  • Index(es):
    • Date
    • Thread