2 Nov 2002 22:39
Re: Garbage collection
Thatcher Ulrich <tu <at> tulrich.com>
2002-11-02 21:39:09 GMT
2002-11-02 21:39:09 GMT
On Nov 01, 2002 at 02:10 -0800, James McCartney wrote: > > On Friday, November 1, 2002, at 12:32 PM, Steve Dekorte wrote: > > >On Friday, November 1, 2002, at 12:21 PM, James McCartney wrote: > >>On Thursday, October 31, 2002, at 03:59 PM, Steve Dekorte wrote: > >>>so only the freed objects are touched on a sweep. > >> > >>Just to press the point, with Baker's treadmill you don't even have > >>to do that. > > > >I just made a small change to make the definitions of black and white > >dynamic that avoids it. Maybe this is equivalent to "Baker's > >treadmill"? The descriptions I've read of it weren't very clear to me. > > With the treadmill you've got linked lists of grey, black, white and > free. To scan an object you remove it from the grey list to black > and put all of the objects it points to onto the grey list. Once the > grey list is exhausted then everything on the white list is not live > and so the entire white list can be linked onto the free list. This > requires changing 6 list pointers. Then you change the meaning of > the color bits so that black now means white and start over. This is cool, but one problem I have with this is that unless you sweep, the "free" objects don't get returned to the C allocator (you don't call C's free() on them). Then, when you go to allocate new objects, the "free list" is essentially an unsorted bag of different-sized chunks. For most Lua purposes, I imagine that an explicit sweep, to finalize and call free(), would be more desirable. -- -- Thatcher Ulrich http://tulrich.com
RSS Feed