[plt-scheme] Some thoughts about GC and realtime aplications
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