Hey, all. I've been trying to learn a bit more about GC's and GC
design lately for my own small language experiment.
Just in case I'm in the wrong place, is there any comp.gc newsgroup or
something of the like? (i.e., am I posting this question in the right
place?)
Anyway, my actual question was:
Is it possible to make a conservative moving GC?
I haven't been able to figure out a way to do this - or find any such
descriptions on the Net, either. The way I understand it is that a
conservative GC takes a place where it looks for pointers - such as
the system stack - and then scans it, looking for bit patterns that
look like pointers to the heap. Now, the problem with this is that it
may find FALSE pointers, for example, just integers which happen to
have the value of a pointer to the heap. This isn't really a problem
in itself, but the problem comes in when you either move the heap, or
move the objects in the heap (compacting GC). At that point, either
you have to somehow update those pointers you used, or your pointers
become invalid. IF all the pointers were real pointers, this would be
trivial - just write the new value to the place where the pointer is
stored. But, pointers might be fake pointers - and writing over one of
those might cause disastrous consequences (imagine that it was a loop
counter or something).
So, is there some way to have a conservative GC which moves it's
objects around?
Explanations, ideas, hints, links to papers - anything is welcome.
Thanks!
-- Andrew Gibiansky


|