It should be 1 since you didn't alloc or manually retain kArr. -
arrayWithObjects autoreleases the created array. This is true across
the Cocoa framework: helper object creation methods always
autorelease unless otherwise annotated in the docs.
On Apr 18, 2008, at 11:06 AM, stephen joseph butler wrote:
In this case, kArr is a key in the dictionary, so NSDictionary makes
a copy (because keys must be immutable). So the retain count doesn't
change.
In the general case, the retain count of an object could change in
response to it being copied. A common optimization for immutable
classes is to implement "-copy" as a call to "[self retain]". This is
obviously a private implementation detail.
In this particular case though, the objects passed as keys are
mutable, and they will for that reason not end up in the dictionary at
all (Just as Stephen notes above, immutable copies will take their
place). This is why you will find that their retain count stays at
whatever it was before that call.
j o a r
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/objc-language/email@hidden