[gclist] Beginning to understand

Douglas.Atique@br.abnamro.com Douglas.Atique@br.abnamro.com
Fri, 16 Jun 2000 15:41:09 -0300

Hello, all.
I am new to the subject of garbage collection and would like to understand some
Many algorithms for garbage collection talk about scanning an object for
pointers. When I first tried to imagine this, I noticed that an object can be
seen as a chunk of memory and at first there seems to be no indication of where
the pointers are, nor how many bytes of memory should be scanned for a given
object (in other words, where the object starts and where it ends). In C++, I
know that type information such as class declarations can give us an indication
of the offset into an object where a given pointer field is, but even so the
garbage collector doesn't know about the class declaration. I heard it uses the
so-called conservative technique, that misses some garbage in order not to
delete live objects. It seems that a pointer as seen by the garbage collector is
only a memory location and has always a value, regardless of being it another
memory address (a pointer) or a primitive type (integer, float, char, etc.).
This also matches the C/C++ programmer's view of memory as related to type
conversions and casts (IMHO, a very "typeless" subject).
I have also seen systems that implement garbage collection by tagging values,
i.e., marking some bits to indicate a pointer, an integer, a float or a char.
That is not very desirable in my opinion because it restricts the range of
values one can have and makes those values' meaning dependent on knowing such
Viewing the situation by this viewpoint, how could I start to understand GC?
Sorry if this question is too newbie. Anyway, the list seems so quiet lately
that I thought it wouldn't bother a lot.
Douglas Atique