[Haskell-cafe] Automatic Reference Counting
David Barbour
dmbarbour at gmail.com
Wed Jul 6 18:01:27 CEST 2011
On Tue, Jul 5, 2011 at 9:00 PM, steffen <steffen.siering at googlemail.com>wrote:
> The important point about reference counting on idevices is the near
> realtime performance, since stops for collecting garbage are actually very
> short in comparison to collecting compilers (despite more frequent).
You can get near realtime performance from any collector if you structure
your application to only need a fixed amount of memory. I.e. you can make
guarantees about the amount of memory collected across any two GC cycles.
On Sat, Jul 2, 2011 at 16:51, Thomas Davie <tom.davie at gmail.com> wrote:
> Apple recently announced a new static analysis in Clang called ARC
> (Automatic Reference Counting). The idea is to provide what GC provides
> (zero memory management code by the programmer), but not to incur the
> runtime penalty of having to have the GC run.
> I was wondering if any of the compiler gurus out there could comment on the
> applicability of this kind of analysis to Haskell. Dropping the GC and
> hence stopping it blocking all threads and killing parallel performance
> seems like nirvana.
RC touches dead data, and GC touches live data. Look at the memory profile
of a typical Haskell program - i.e. live memory ranging in megabytes, dead
data ranging in hundreds of megabytes (if not gigabytes) per second. It is
unlikely that we'll get much better performance from reference counting,
though a hybrid model might be useful for the later generation (where
collections are rarer).
I think Haskell could do a lot to improve its concurrent GC. At the moment,
each processor has a space of its own that it can collect concurrently, plus
there is global collection that freezes all threads and cleans up all
garbage in the later generation. For very-large-memory apps, we could do a
lot to extend concurrent GC into later generations, do a more effective job
of either managing our own paging or integrating with OS virtual memory,
and avoid the global collection as a last resort. Pauses with paging-aware
collectors can be improved by over two orders of magnitude [1].
[1] Garbage Collection without Paging<http://lambda-the-ultimate.org/node/2391>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110706/f09411fb/attachment.htm>
More information about the Haskell-Cafe
mailing list