lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

> > ...or Lua could use a generational garbage collector...
> Do you have one laying around we could just plug in?
> Seriously though, you make it sound so simple. I believe the
> work required from the Lua point of view is about the same
> given the incremental or generational solution. Both must
> still know whenever references change.
> I guess a generation GC works similarly to the const data
> idea of mine, but the GC must be smart enough (and have
> the cooperation of the VM) to figure out when something in
> the const data changes and must then be walked during the
> next GC. Perhaps there is a simple way to do this that
> I am not aware of?

The idea is more that you only collect the "young" generation most of the
time (a "minor" collection), and then collect the "old" generation when
you're really running out of heap (a "major" collection).

Hopefully, things work out so that in a game you can wait to do a major
collection until you have the time to walk the entire heap, and the "young"
generation quickly empties, so that only transient data structures are held

In other words, you simply don't look at much of the heap a lot of the time,
even if it has changed (hopefully it hasn't!). I don't think this is
particularly hard. It should certainly be easier than incremental

-- | violence, n.  bravery for cowards