Re: nonatomic vs atomic assign/retain
Re: nonatomic vs atomic assign/retain
- Subject: Re: nonatomic vs atomic assign/retain
- From: Jens Alfke <email@hidden>
- Date: Tue, 06 Sep 2011 09:50:31 -0700
On Sep 6, 2011, at 9:09 AM, Joar Wingfors wrote:
> There's an additional consideration to keep in mind - @synthesized getters use the retain+autorelease pattern which makes local variables acquired from such getters "safer" in certain (unusual) usage patterns.
And considerably more expensive in all cases, since calling a getter now involves messing with retain counts and autorelease pools. It also means the getter method has to contain a whole register-saving preamble and postamble instead of just the couple of instructions to pull out the ivar value.
At the time ObjC-2 was in development there was a debate within Apple about whether to make ‘nonatomic’ be the default, with an ‘atomic’ keyword to enable the safety features. I really wish it had gone that way.
—Jens_______________________________________________
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