[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Garbage collection
- From: "Russell Y. Webb" <rw20@...>
- Date: Wed, 30 Oct 2002 09:13:15 -0800
On Wednesday, October 30, 2002, at 07:13 AM, Steve Dekorte wrote:
On Tuesday, October 29, 2002, at 09:22 AM, Russell Y. Webb wrote:
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.
That might not be possible as some collectors require write and/or
read barriers(you need to tell them when a reference is added or
read). Putting in these barriers and leaving hooks to them would cost
too much in overhead. You could avoid the unused hook overhead with
defines, but still, you'd add a lot of complexity to the C bindings
that likely wouldn't be used.
It's true that you might wind up with too many hooks for it to look
clean. You could leave it up to your compiler to optimize away calls
to empty function --- compilers are good at that these days.
It would be interesting to see a list of hooks that would support mark
and sweep, generational mark and sweep, incremental versions, and
reference counting. Something like
gc_init
gc_cleanup
gc_ref
gc_unref
gc_write
gc_read
gc_begin_collection
gc_continue_collection
gc_end_collection
Russ