lua-users home
lua-l archive

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


> From: Thatcher Ulrich
> 
> On Fri, 30 May 2003, [iso-8859-1] Tobias Käs wrote:
> 
> > As the question required the list to be kept existend by a 
> pointer to 
> > _any_ element in the list, the solution you gave is 
> insufficient. If 
> > the pointer does not point to the first entry, the weak 
> part will get 
> > lost. If you make the weak part strong you have cycles ;-)
> 
> Hm, true.  What we typically do in practice: use raw pointers 
> for the internal links, and keep the objects alive through 
> other means (e.g. have strong references in an array somewhere).

And you're suggesting we forget IGGC in favour of more simple RC? :-) I think the most complicated and potentially erroneous aspect of IGGC is the write barrier. Once this is intact and bug free I think the GC algorithm would be pretty well encapsulated, albeit a little complicated.

Interestingly, the Python IGC collects garbage! I.e. is looks for unreachable objects, not reachable ones; apparently the root set is difficult to determine because if the module implementation. Only "container" objects, that can contain references, are checked for references. This is somewhat simplified in Lua since tables represent all of the container objects in Python. So, Lua's GC implementation may be simpler to implement than Python, and hidden from the user, unlike Python's.

--Nick