• 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: NSMutableDictionary Leak
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMutableDictionary Leak


  • Subject: Re: NSMutableDictionary Leak
  • From: dct <email@hidden>
  • Date: Fri, 28 Nov 2008 16:56:11 -0800

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't understand why Leaks points me twice to a line that reads:
[tmp setObject:[NSDictionary dictionaryWithDictionary:tmp2] forKey:@"Data"];



On Nov 28, 2008, at 4:17 PM, Bill Bumgarner wrote:

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:

http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/MemoryMgmt.html

Specifically, the above is over-releasing the dictionary. If your program isn't crashing, it is only because you are over-retaining it somewhere else.

b.bum

_______________________________________________

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: 
 >NSMutableDictionary Leak (From: dct <email@hidden>)
 >Re: NSMutableDictionary Leak (From: Bill Bumgarner <email@hidden>)

  • Prev by Date: Re: NSMutableDictionary Leak
  • Next by Date: Re: NSMutableDictionary Leak
  • Previous by thread: Re: NSMutableDictionary Leak
  • Next by thread: Re: NSMutableDictionary Leak
  • Index(es):
    • Date
    • Thread