[Haskell-cafe] Automatic Reference Counting

Thomas Davie tom.davie at gmail.com
Sat Jul 2 18:35:00 CEST 2011


On 2 Jul 2011, at 17:18, Thomas Schilling wrote:

> Reference counting usually has much higher overheads than garbage
> collection and is tricky to parallise.  It's main advantage is quicker
> release of memory.
> 
> I believe the main feature of ARC is that the user does not need to
> manually keep reference counts up to date.  I heard from people using
> CPython (which uses reference counting) as a library from C that it's
> very easy to accidentally forget to update the reference count
> correctly.  With ARC the compiler takes care of it, so there's less
> opportunity for mistakes.  ARC also optimizes away redundant reference
> updates within a function (Haskell functions are usually small, so I
> don't know how well that would work).

Apple's claim is that their optimiser works globally and can optimise away redundant reference updates across functions too.

It's interesting that you cite that GC is both faster and lower memory overhead – Apple's stated reasons for implementing this were that GC was both too slow and too memory intensive to use sensibly on iDevices and that ARC was both faster and less memory intensive.

Tom Davie




More information about the Haskell-Cafe mailing list