[Haskell-cafe] Real-time garbage collection for Haskell

Sebastian Sylvan sebastian.sylvan at gmail.com
Mon Mar 1 12:16:32 EST 2010

On Sun, Feb 28, 2010 at 5:20 AM, Luke Palmer <lrpalmer at gmail.com> wrote:

> I have seen some proposals around here for SoC projects and other
> things to try to improve the latency of GHC's garbage collector.  I'm
> currently developing a game in Haskell, and even 100ms pauses are
> unacceptable for a real-time game.  I'm calling out to people who have
> seen or made such proposals, because I would be willing to contribute
> funding and/or mentor a project that would contribute to this goal.
> Also any ideas for reducing this latency in other ways would be very
> appreciated.

Since we're talking games here (my profession), I'd point out that it would
be cool to be able to supply "hints" to the GC about when might be a good
time to do a GC (without unconditionally forcing it), games in particular
have some pretty specific properties that may be exploitable.

Presumably a non-trivial portion of the objects copied from the nursery/G0
are actually short-lived objects that just happened to have their short
life-span overlap with the collection. So really, copying them to the next
generation is a "mistake" in some sense. For games, though, we have a very
good point that occurs regularly where we know that all/most short-lived
objects will no longer be referenced - at the start of a fresh frame.
So if we could do as many as possible of our G0 collections at that point
we'd avoid "accidental copying" of objects that are actually short-lived
into the older generation (which should reduce pressure on that older
generation, as well as speed up G0 collection). Ideally we'd have some way
of telling the GC to try to avoid running during the actual frame itself,
too, by for example tuning the heap region sizes automatically.

Sebastian Sylvan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100301/82657034/attachment.html

More information about the Haskell-Cafe mailing list