[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: garbage collection thoughts... again?!
- From: paul@...
- Date: Thu, 29 May 2003 15:02:53 +0800
Well... this may seem redundant but anyway, I am going to repeat
that I've posted a incremental hack on to Lua 4.0 a year ago.
But it wasn't fully successful even though it works to some
extent. some smart people out there could just help to nail
down the final bug!!
Back to the topic of Lua's mark & sweep, my other quick (and
successful) hack after the above mentioned (unsuccessful)
incremental GC attempt is to do "mark & sweep + incremental
collect".
The basic idea is that object destruction is usually the most
expensive part if it involves many GC callback. So what I
did was to chain up garbages instead of destructing them during
the sweep step, and then incrementally clean them up. This
later proved to work very well, and solved all my previous
issues with Lua's long GC halt.
Interested parties can get the above mentioned two packages
from http://www.gime.org/twiki/bin/view/Gime/WebDownload
Regards,
.paul.
On Wed, May 28, 2003 at 11:19:23PM -0700, Mark Hamburg wrote:
> I agree that reference counting can work well. I've used it extensively in
> some C++ projects and I'm using it while doing Cocoa development. On the
> other hand...
>
> * Cycles are more common than you might think. Imagine a view system with
> pointers from parents to their children and pointers from children to their
> parents. The work around in many systems is to sacrifice safety by choosing
> not to count some references. Other safe work arounds increase the
> complexity of the implementation.
>
> * The overhead of doing reference counting gets expensive for parameter
> passing on the stack. A lot of time can be wasted incrementing and
> decrementing reference counts. There are work arounds for this but they are
> generally more complicated than simple implementations of reference counting
> or they sacrifice safety.
>
> Mark-and-sweep is simple and reliable. Its downside is that it is slow to
> collect garbage and it is tricky to make incremental.
>
> That being said, I could see a case being made for investigating reference
> counting for Lua as an alternative to an incremental, generational, fully
> buzzword compliant garbage collector.
>
> Mark
>
> on 5/28/03 10:47 PM, Thatcher Ulrich at tu@tulrich.com wrote:
>
> > In case anyone is interested, I've written down my current thoughts
> > about garbage collection (not necessarily specific to Lua), including
> > a nice succinct quote by Ken Thompson. Executive summary:
> > ref-counting is good. Here's the longer version:
> >
> > http://tulrich.com/geekstuff/ref-counting-is-good.txt
> >
> > I know the Lua authors have said they're working on incremental +
> > generational collection. I don't know how far along that work is, but
> > I'm throwing this into the pot in case it's interesting or helpful.
> >
> > -Thatcher
> >
>