Re: NSMutableDictionary Leak

2008-11-28 Thread Michael Ash
On Fri, Nov 28, 2008 at 7:04 PM, dct <[EMAIL PROTECTED]> wrote: > I've started using Instruments/Leaks on a project that has been building and > running as expected. It has identified a goodly number of CFDictionary leaks > (a Malloc leak followed by an Autorelease leak) associated with lines that,

Re: NSMutableDictionary Leak

2008-11-28 Thread dct
Dave, Thanks for your reply. Believe your points re autoreleasing match those of Bill Bumgarner -- as I replied to him I originally didn't autorelease in the lines in question which seemed to run nicely but which seemed to be the cause of Instruments/Leaks identified leaking. Re your warn

Re: NSMutableDictionary Leak

2008-11-28 Thread dct
Thanks for the reply. Turns out I added that autorelease after Leaks pointed to the line NSMutableDictionary *tmp = [NSMutableDictionary dictionaryWithCapacity:4] (and to several other lines involving "tmp") as a leak source. Either way, the program runs without crashing. And I still don

Re: NSMutableDictionary Leak

2008-11-28 Thread Dave DeLong
This may not fix your problem, but it doesn't look like you're using the convenience methods correctly. NSMutableDictionary *tmp = [NSMutableDictionary dictionaryWithCapacity:4]; tmp comes back with a retain count of 1, but it is already autoreleased. You don't need to do any sort of re

Re: NSMutableDictionary Leak

2008-11-28 Thread Bill Bumgarner
On Nov 28, 2008, at 4:04 PM, dct wrote: The MutableDictionary object "tmp" is instantiated at the beginning of this particular method by: NSMutableDictionary *tmp = [[NSMutableDictionary dictionaryWithCapacity:4] autorelease]; You need to review the Cocoa memory management documentation:

NSMutableDictionary Leak

2008-11-28 Thread dct
I've started using Instruments/Leaks on a project that has been building and running as expected. It has identified a goodly number of CFDictionary leaks (a Malloc leak followed by an Autorelease leak) associated with lines that, in one typical case, reads: [tmp setObject:[NSDictionary di