Despite ARC banned retain/release/autorelease functions, there are still 
alternatives there in the form of C functions:

From CoreFoundation <CoreFoundation/CoreFoundation.h>:
CFRetain() = retain
CFRelease() = release
CGBridgingRelease() = autorelease

From LLVM’s requirements to runtime for ARC to work, as prototyped in GNUstep’s 
<objc/objc-arc.h>:
objc_retain() = retain
objc_release() = release
objc_autorelease() = autorelease

Prototypes:
id objc_retain(id);
void objc_release(id);
id objc_autorelease(id);

All six functions exist in Apple runtime, in CoreFoundation.framework and 
libobjc.dylib respectively. CoreFoundation ones call libobjc ones internally.

On Oct 23, 2013, at 5:10, Greg Parker <gpar...@apple.com> wrote:

> On Oct 21, 2013, at 10:14 PM, Jens Alfke <j...@mooseyard.com> wrote:
>> As for autorelease: "This has come up once before for me, and I was able to 
>> work around it by making the cache-owner object call -autorelease instead of 
>> -release on the NSCache, to defer the call to the cache’s dealloc. But I’m 
>> now using ARC so that isn’t an option.”
>> 
>> Although there’s probably some hacky way to force an autorelease…
> 
> The supported way to force autorelease in ARC is to write a function in a 
> non-ARC file that calls retain/autorelease.
> 
> 
> -- 
> Greg Parker     gpar...@apple.com     Runtime Wrangler
> 
> 

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________

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

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

Reply via email to