Typically for me the GC spends about 50% of its time in mark phase,
50% in sweep phase.  Around there somewhere.

Question.  Would it be possible to do the sweep phase in a separate thread?

something like:

mark phase as currently is.
sweep phase creates a "second" freelist in other thread. during the
sweep phase calls to rb_newobj mark outgoing objects appropriately so
they aren't collected by the sweep thread.  Some how or other race
conditions could be avoided.

Thus
1) no contention between two freelists
2) typically the GC is called without exhausting the freelist, thus
the main thread could continue running.

Note: use of ObjectSpace.each_object and weakrefs would need to be
synchronized to always allow any GC sweep thread to finish first.

On a multiple core machine could save time for the main thread.  On a
single core machine it would enable the main thread to not be
interrupted as long by the GC [though it would run slower during the
swep phase, at least it would run]

Thoughts?
=r