[Gc] New GC Scheduler

Neal H. Walfield neal at walfield.org
Wed Jun 18 15:28:16 PDT 2008


Hi,

I'm working on an experimental operating system kernel called
Viengoos.  One feature is that Viengoos exposes the amount of physical
memory available to a resource principal.  I am trying to modify the
the GC scheduler to perform collections when the amount of allocated
memory exceeds some percentage of the available memory.

I've made two changes.  First, in alloc.c, I changed GC_should_collect
to:

  if (GC_adj_bytes_allocd() < min_bytes_allocd())
    return FALSE;

  return GC_get_heap_size() - GC_unmapped_bytes > 7 * available / 8;

Second, because this doesn't actually free any memory and because
collections are relatively infrequent, I change GC_unmap_old in
allchblk.c to unmap all mapped memory on the free lists.

To test my changes, I am using the GCbench program.  I've wrapped it
in a for loop.  Basically, this program allocates trees and then frees
them.

In my current setup, the amount of available memory is constant.  The
collector correctly runs when the allocated memory exceeds the
low-water mark.  95% of the memory is then unmapped.

After some number of collections, a collection that seems perfectly
normal, will result in the triggering GC_NEW returning NULL.  I'm
still investing this but would like some feedback:

Is it kosher to unmap all of the memory?

Is my approach sound; am I overlooking something important?

Thanks for any insights,
Neal



More information about the Gc mailing list