Mac Apps That Use Garbage Collection Must Move to ARC

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Sat Feb 21 12:22:23 PST 2015


On Saturday, 21 February 2015 at 19:20:48 UTC, JN wrote:
> https://developer.apple.com/news/?id=02202015a
>
> Interesting...
>
> Apple is dropping GC in favor of automatic reference counting. 
> What are the benefits of ARC over GC? Is it just about 
> predictability of resource freeing? Would ARC make sense in D?

Apple never was able to roll out a good GC for ObjC and got back 
to ARC (an overly complex reference counting system that the 
compiler is aware of).

You get the usual tradeof of RC vs GC :
  - RC is more predictable.
  - RC has less floating garbage, so usually a lower memory foot 
print.
  - RC usually increase cache pressure as you need to have 
reference count ready and hot.
  - RC behave (very) poorly when reference are shared across 
cores, as they ill compete for cache lines. It tends to be faster 
in single threaded mode, but that depends on the type of 
application (graph manipulation for instance, tend to behave 
poorly with RC).
  - RC can leak.
  - RC is unsafe without ownership.


More information about the Digitalmars-d mailing list