lua-users home
lua-l archive

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


Hi,

skaller wrote:
> BTW: scanning the Lua gc code, it seems to use a naive
> mark/sweep collection algorithm (my Felix collector does too).

Apparently you have looked at Lua 5.0. There is a prerelease version of
Lua 5.1 available at: http://www.lua.org/work/lua-5.1-work3.tar.gz

Lua 5.1 has a completely revamped incremental and generational GC. The
tri-colour GC algorithm implies use of the state toggling optimization.

> Step (a) can be avoided. We keep a persistent variable
> 'parity' which is 0 or 1. When we allocate an object,
> it gets marked immediately with the inverse of this flag

See g->currentwhite and the otherwhite() macro in lgc.h and lgc.c in Lua 5.1.

Bye,
     Mike