[SDL] I Need a Game Interpreter

Rainer Deyke root at rainerdeyke.com
Sun Sep 1 20:41:01 PDT 2002


Matthew Bloch wrote:
> From experience: don't *ever* use an automatic, garbage-collected
> runtime for a game.  I've spent many painful hours with Ruby trying
> to stop it from messing up my frame rate and only partially
> succeeded, much as I love the language for other jobs.  Once you've
> built your foundation on such a runtime there's very little you can
> do about it when you notice your game jerks every few frames.  Mark
> and sweep garbage collection involves forgetting about memory that
> you've allocated and every so often traversing an enormous tree of
> pointers to reclaim some memory.  If you don't do it, or delay it
> much, your program will run out of memory.  Do it as often as the
> language wants, and you'll never get a consistent frame rate.
> There's also nothing you can do to interrupt it-- once the recovery
> algorithm starts it must run to completion or start from scratch.

Do it once per frame, and your frame rate will be consistent (although
possibly too slow to be useful).

> Python uses reference counting to automatically free memory, and so
> the work of reclaiming memory is spread evenly over execution,
rather
> than concentrated into long lumps as with GC.

Note that Python still uses garbage collection to deal with cyclic
references.


--
Rainer Deyke | root at rainerdeyke.com | http://rainerdeyke.com





More information about the SDL mailing list