next up previous contents index
Next: The Mark Sweep collector Up: Garbage Collection in the Prop Library Previous: Messages and Statistics

The Bartlett style mostly copying collector

Currently a Bartlett-style mostly copying collector has been implemented. The current version is non-generational but we expect that a generational version will be available in the near future.

The Bartlett-style collector is implemented as the concrete class BGC . Aside from all the services provided by class GC , BGC  also provides the following method:

   class BGC : public CGC {
   public:
      virtual void set_gc_ratio(int);
      virtual void set_initial_heap_size (size_t);
      virtual void set_min_heap_growth   (size_t);
   }

The gc ratio refers to the ratio of used heap space versus total heap space. Class BGC  will invoke the garbage collection if this is exceeded. The default gc ratio for BGC is 75%.

The initial size of the heap and the minimal number of bytes to request from the system during a heap expansion can be adjusted using the methods set_initial_heap_size and set_min_heap_growth respectively. These methods are declared in the GC protocol. By default, the initial heap size for this collector is 128K and each heap expansion will increase the heap by 512K.

If an application uses a lot garbage collected storage it is a good idea to set the heap size to larger capacity during initialization. Otherwise, the collector will have to perform more garbage collection and heap expansions to reach a stable state.



Allen Leung
Mon Apr 7 14:33:55 EDT 1997