[gclist] half flips

James McCartney asynth at io.com
Sun Aug 1 09:49:19 PDT 2004

I am using a gc based on the Johnston-Wilson real time gc, which is 
basically a set of Baker treadmills in power of two size classes. I 
allocate white and set a constant scan rate per allocation so that I 
have a constant real time cost.

Normally a flip of the gc involves moving all white objects to free, 
all black objects to white, and swapping the meaning of the white and 
black color tags.
I recently realized that I can simulate generations almost for free by 
doing a normal flip (which I call a "major flip") only one out of four 
times and at other times do a "minor flip" which is just: move all 
white objects to free. Since this leaves the black objects black 
objects that tend to live longer get scanned less frequently. Since the 
minor collections finish quicker and free space gets returned quicker, 
I can throttle down my collector saving CPU cycles on GC. It costs a 
little more memory overhead but it seems to be geared down. i.e. the 
same change in down throttling now causes smaller increase in memory 
overhead than it did before.

I was wondering if anyone else had done this.

--- james mccartney   james at audiosynth.com   <http://www.audiosynth.com>
SuperCollider - a real time audio synthesis programming language

More information about the GClist mailing list