At 11:28 AM -0800 12/29/03, Jeff Clites wrote:
On Dec 29, 2003, at 8:13 AM, Dan Sugalski wrote:

2) We need a more traditional, non-moving GC as an alternative to the copying collector. A modified mark & sweep'd be fine, but as it'll be living behind the API it doesn't much matter.

This is really only for the chunks of memory backing strings and such, right? We're already using mark-and-sweep for PMCs and strings and such (that is, their headers), right?

Right, this is for the memory pools backing string bodies and other variable-length things.


As I see it, it's really the allocation that is more complicated with a mark-and-sweep collector (since you have to search for a correct-sized free chunk, efficiently)--the collection itself is the easy part. Actually, it seems like this is just the GC_IS_MALLOC case--that already gives us non-moving GC, and lets malloc (the system version or the Lea version) deal with managing the bookkeeping.

Allocation's more complex, but so is deallocation. Properly maintaining a free list with adjacent piece coalescing can be non-trivial, and there's the added complication of COW so multiple string headers may be pointing to the same chunk of memory, so freeing up one's not a sufficient reason to return the memory to the free pool.


#2 is a bit more interesting and, if we do it right, means that we'll end up with a pluggable garbage collection system and may (possibly) be able to have type 3 threads share object arenas and memory pools, which'd be rather nice. Even if not, it leaves a good window for experimentation in allocation and collection, which isn't bad either.

This, combined with the mention of needing to drive this off of a vtable, means being able to determine the GC algorithm at runtime instead of compile-time (i.e., that was part of your point). I'm all for that--it will mean less #if's in the code, and it will make the code a bit clearer.

Yep. Care to take a shot at it? -- Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to