[plt-scheme] Collect-Garbage not enabled on Dr. Scheme?

From: Noel Welsh (noelwelsh at gmail.com)
Date: Sun Apr 5 16:10:04 EDT 2009

2009/4/5 emre berat nebioğlu <beratn at gmail.com>:
> I have two more things to say firstly i wonna talk about some
> misunderstanding point in the links that you gave.What does "make
> conservative guess" mean ?

A garbage collector has to figure out which pieces of memory are live
data the should be saved, and which pieces of memory are garbage and
can be reused. It does this by tracing all the pointers starting from
the "root set" and finishing when there are no pointers left to
follow. To do this it must know which pieces of memory -- the
registers, heap, and stack -- represent pointers, and which represent
other values in the program. Typically this is done by using a
predefined memory layout which includes various tags that are tell the
GC what is what. This requires all code cooperates with the GC, by
using this layout. Now code that is written without the GC in mind
will not work, as it won't use the correct layout. A conservative GC
doesn't require a predefined layout -- it takes a guess as to what is
a pointer and what isn't. Sometimes it gets the guess wrong and a
piece of memory that should be reused isn't. Thus a conservative GC is
good for interoperating with code that wasn't written for the garbage
collector (most C code) but it leaks memory.

> I know that Drscheme was written in C language.And mail said it is using CGC
> and said easy to interprete with C.

Some of DrScheme is written in C. I would say most of it is written in Scheme.

A textbook on programming language implementation will have a more
complete discussion of GC. I think there is material in PLAI:



Posted on the users mailing list.