This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: conservative gc



; In the last posts, it was said repeatedly that the garbage collection of guile
; is conservative.

; What does this mean? Is this related to conservation laws in physics (mass,
; energy, momentum etc.) Is 'mark and sweep' necessarily conservative?

Conservative GC may not collect all garbage that is referenced, ever.
In this acse, it means that anything that looks like a pointer in the
C stack causes anything it might point to to not be collected.  This
is important in making guile C code easy to write. 

; What alternatives would there be to conservative garbage collection? R*RS
; doesn't recommend any particular gc strategy at all, so may be other scheme
; implementations act differently, even more Common Lisp engines.

Conservative garbage collection forces us to forego certain (possibly
more efficient) schemes for collecting garbage.  For example, copying
GC is thought to have better cache characteristics (or something), but
it's not practical in a conservative system; you'd have to change any
bit patterns in the C code that appear to be ppointing to something
you moved.  This could be really bad. 

Now, there are things to consider.  Right now our garbage collection
is a serial mark and sweep system.  This means that we zip along,
merrily computing away, until we run short of memory.  Then the entire
system (all threads) grinds to a halt.  We scan all of memory (swap,
swap, swap) and free the junk.  (swap again)  There are algorithms
that have better characteristics.  Some of them are even
conservative.  There's at least one that is conservative (enough so to
be used in pure C code) and mostly parallel --- that is, it runs in a
separate thread, and only has to stop computation for a small party of
the cycle.  

Andrew
aarchiba@undergrad.math.uwaterloo.ca