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

Luke Palmer lrpalmer at gmail.com
Tue Mar 2 15:37:23 EST 2010


On Tue, Mar 2, 2010 at 7:17 AM, Simon Marlow <marlowsd at gmail.com> wrote:
>> 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.
>
> System.Mem.performGC is your friend, but if you're unlucky it might do a
> major GC and then you'll get more pause than you bargained for.

Some fine-grained control might be nice here.  Eg. I could do a major
GC as a player is opening a menu, on a loading screen, when the game
is paused, or some other key points, and it might still be annoying,
but at least it wouldn't interfere with gameplay.  There is of course
the question of what happens if one of these key points doesn't happen
when we need to do an allocation, but... oh well.  Perhaps that could
be mitigated by saying "I would rather you allocate than major GC
right now".  Are any of these options impossible, or be unreasonably
difficult to implement (I don't suspect so)?

Luke


More information about the Haskell-Cafe mailing list