Re: Problem with NSMutableDictionary
Re: Problem with NSMutableDictionary
- Subject: Re: Problem with NSMutableDictionary
- From: Francis Derive <email@hidden>
- Date: Sat, 18 Aug 2007 22:12:30 +0200
On Aug 18, 2007, at 10:02 PM, Andrew Farmer wrote:
On 18 Aug 07, at 11:57, Francis Derive wrote:
It is a cocoa app.
- An action of the app delegate is to
- initialize a window controller : dsUserMainMenuWindowCtrl =
[[DSMainMenuWindowController allocWithZone:[self zone]]
initForUserLand:@"fr"
- show the window controller's window
- The init implementation of the window controller
- loads its nib
- initializes its NSMutableDictionary *instance variable :
NSMutableDictionary *activeAppsLanguageStrings =
[NSMutableDictionary dictionaryWithCapacity:1];
[NSMutableDictionary dictionaryWithCapacity:] returns an
autoreleased dictionary (read the Cocoa memory management rules for
an explanation of why this happens). As you don't appear to be
explicitly retaining it in your code, it's getting released.
Andrew,
Short answer : many thanks.
Longer answer : I hate to be caught to this penalty.
Doc onto dictionaryWithCapacity should remind this which otherwise
might be in the Cocoa Memory management rules to be revisited. Apps
runs.
Cheers,
Francis
_______________________________________________
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