On Sat, Aug 24, 2002 at 04:19:08AM +0900, Justin Johnson wrote: > > It certainly used to be the belief that moving collectors are better than > mark and sweep although I'm not sure if this viewpoint is generally holding > now. I read somewhere that a number of studies have shown that moving > collectors can have worse virtual memory and caching behaviour. > > I've decided to stick with mark and sweep because I don't like the idea of > copying lots of memory about for reasonable sized objects. Generations help > by reducing the amount of live data to scan but there's no reason why mark > and sweep can't be generational too. In fact, this is the approach I've > taken. A bit of work is needed to avoid fragmentation but it's not been too > difficult. There's however a problem with bringing generational GC to Ruby. If your generations are G0 (newer), G1, ..., when marking objects in G0 you have to go through "root variables"(frames, globals...) AND the objects in G1, ..., Gn which point to things in G0. For Ruby to be able to do that, there would have to be a function to register an object of generation Gn as pointing to another of generation Gi where i < n. That way it would be able to do the marking only with the roots and the "updated" objects in Gi+1,...,Gn. Otherwise you end up scanning G0, ..., Gn, and generational GC buys you nothing. Ruby could take care of this automagically if the code that makes an object point to a newer one is done in Ruby, but we'd have to do it if it is in C. So making Ruby's GC generational involves changing stuff in more places than gc.c, plus breaking most of the extensions :-| -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com Windows without the X is like making love without a partner. -- MaDsen Wikholm, mwikholm / at8.abo.fi