lua-users home
lua-l archive

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

The issue of garbage collectors is very interesting --- there are so many variations and trade-offs.

Personally, I think the best (and most Lua-like) solution is to make the garbage collector completely modular with a published way to redefine it with appropriate hooks (many of which can be empty) to define most any scheme. Then Lua should stick with it's current garbage collector in the interest of simplicity and small code size, while allowing a range of alternate solutions to flourish via a supported API (right now it's fairly modular, but that modularity is not supported or possible to replace without touching the source).

Of course the problem that arises will be, can efficiency and abstraction both be achieved in the API? One might have to resort to a redefinable lua_gc_data structure (for reference counts, marks, etc) that is part of every object which the garbage collector defines and only the garbage collector knows how to look inside of, since having the garbage collector maintain information in separate tables is inefficient for some models.