Horst Jäger wrote:

NSDictionary *di = [[NSDictionary alloc] init];
NSArray *ar = [di allKeys];


di is an empty NSDictionary. Therefore, ar will always be an empty immutable NSArray. Consequently, it's possible to return a singleton empty NSArray that's never released. I'm not saying this *is* happening, just that it *could* happen under the memory mgmt rules.

The code is fatally flawed because it doesn't follow the memory mgmt rules. All observed effects (like NSLog'ing the retainCount) rely on unspecified side-effects. You shouldn't be surprised when unspecified side-effects occur, nor should you count on them always occurring in the same way.

  -- GG

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to