On Jan 30, 2013, at 12:42 AM, Charles Srstka <[email protected]> wrote:
> On Jan 30, 2013, at 1:25 AM, Greg Parker <[email protected]> wrote:
>> Name the method `new...` instead of `create...`. Otherwise you do suffer an 
>> autorelease penalty with ARC. (`create...` is not one of the names that ARC 
>> assumes will return a retained result.)
> 
> Huh? I thought ARC generated objc_autoreleaseReturnValue in this case, which 
> peeks up the stack to see if the caller is calling 
> objc_retainAutoreleasedReturnValue on it, and refrains from autoreleasing the 
> object if it does.

It does. All of that is relatively inexpensive, but still has a cost. Simply 
passing along the retained value as returned by -init... is free. (Ideally, 
+new... tail-calls -init...)


-- 
Greg Parker     [email protected]     Runtime Wrangler



_______________________________________________

Cocoa-dev mailing list ([email protected])

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

This email sent to [email protected]

Reply via email to