[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Latent bugs?
Re: Latent bugs?
28 Dec 2002 20:22:57 +0100
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2
Marko Rauhamaa <address@hidden> writes:
> The Guile manual doesn't state that basically all writable memory of
> a process participates in GC:
Hmm. More needs to be said to get a accurate picture of how GC works
The Guile GC does only manage objects that are represented as a value
of type SCM. All these objects are either immediate (and thus don't
need to be freed), or they consist of at least a header cell. Thus,
one can say that the Guile GC only manages these header cells. A
string, for example, consists of one such header cell and the memory
to hold the characters. When a string is freed, the cell and the
additional memory is freed together.
Now, to do its thing, the GC needs to find all references between life
objects, and also needs to know about the root set of references. The
root references can either be known precisely (protecting a object via
scm_gc_protect_object creates such a known, precise root reference) or
they can be searched for in a specified memory region. During this
search, all words are considered and when the bit pattern can be
interpreted as a SCM reference, it is assumed to actually be one.
When you say that "basically all writable memory of a process
participates in GC", you probably mean that all writable memory of a
process is taken to be in the root set, and is searched for potential
references. This is not true. Only the stacks (of all threads) and
the registers are searched in this manner. The global heap is not
The GC algorithm has changed somewhat in the recent past, but the
behavior re where root references are found has not been changed.
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405