cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kerri Shotts <kerrisho...@gmail.com>
Subject Re: Should Automatic Reference Counting be on?
Date Fri, 11 Jan 2013 18:20:26 GMT
My two cents:

If it's feasible to support ARC, I'd go for it. Having worked with ARC and non-ARC code, ARC
is definitely easier on my brain cells -- I'm far too likely to leak memory like a sieve with
manual memory management… 

That said, converting Cordova's base code from non-ARC to ARC may not be trivial. In theory,
you can just get rid of autoreleases, retains, deallocs, and handle properties (assign/retain/copy
--> weak,strong), but sometimes you end up getting into toll-free bridging between Cocoa
and Core Foundation, and occasionally you run into more obscure problems (such as ARC releasing
the object before the code expected it. Easy to fix, but not always /obvious/ prior to experiencing
the issue.) 

Once we have ARC support, though,  the -fno-objc-arc compiler flag is a per-file setting,
so I would think that the plugin tools could set that flag based on whether or not the plugin
supported ARC or not. (I would think this should be determined in the metadata somewhere?
Perhaps defaulting to no-ARC if there's no metadata saying one way or the other?)


On Jan 11, 2013, at 9:14 AM, Andrew Grieve <agrieve@chromium.org> wrote:

> This caught me off-guard as well, and I filed an issue to fix it up:
> https://issues.apache.org/jira/browse/CB-2180
> 
> I don't think it'll be entirely straight-forward though, because some
> plugins still do not support ARC.
> 
> What are everyone's thoughts on how to address this? One option is to have
> the default project template already set-up with two lib targets. One for
> ARC and one without ARC. Another option is to instruct users how to set the
> compile flag to disable arc on a per-file basis.
> 
> Do we want to support ARC and non-ARC plugins in plugman?
> 
> 
> On Thu, Jan 10, 2013 at 6:52 PM, Jacob Weber <jacob@jacobweber.com> wrote:
> 
>> When I create a new iOS project with Cordova 2.3, Automatic Reference
>> Counting (CLANG_ENABLE_OBJC_ARC) is turned off. And the code (e.g.
>> AppDelegate.m) uses autorelease, which I'm pretty sure is incompatible with
>> ARC.
>> 
>> Is this correct? Based on this blog post, I thought it should be on:
>> 
>> http://shazronatadobe.wordpress.com/2012/09/05/automatic-reference-counting-arc-and-cordova-plugins/
>> 
>> Jacob


Mime
View raw message