[plt-scheme] Some thoughts about GC and realtime aplications

From: Will Farr (farr at mit.edu)
Date: Fri May 19 11:10:08 EDT 2006


You might also take a look at Frag:
http://haskell.org/haskellwiki/Frag .  It's a first-person-shooter
written completely in Haskell.  Since it was a senior thesis project,
there's a paper on it which may mention how it dealt with the GC
issue.  I know that the implementor used reactive programming (FrTime
in Scheme, if I'm not mistaken) to implement the event loop, and it
generally looks pretty slick.


On 5/18/06, Ivan Boulanov <l00bis at mail.ru> wrote:
> I have been thinking about how Lisp or Scheme can be used for game
> development. This meditation was inspired by Naughty Dog`s amazing
> experience. I find that there is almost no hard problems for Scheme in
> particular to become some day an industrial-standard language for such a
> purpose. No hard problems except for GC.
> GC, IMHO, is hardly applicable for realtime programs in common and for games
> in particular. GC happens rarely but takes a lot of time and halts execution
> for a moment that is sufficient for the game to become unplayable.
> I think that the possible solutions to the problem could be the following.
> The game should allocate a rather big storage at the level loading time and
> then perform GC only on next level loading.
> The other issue relates to small objects. Such an objects are born and
> become garbage very often so programmer have to take care to avoid them, but
> this is rather inconvenient. I think that the better approach would be to
> use continuous GC. This means that while the realtime application is
> running, GC is also running, but in a background thread, and this thread
> takes care to utilize as little CPU time as possible.
> A completely different approach is to use reference-counting instead of GC.
> This approach is similar to the modern C++ programming approach of smart
> pointers.
> I wonder maybe I have just invented a wheel?
> What do you think about the matter?
> And one more question arises: how can I create a custom memory manager for
> PLT Scheme?
> Best regards,
> Ivan Boulanov
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.