|Recognising pointers during garbage collection? firstname.lastname@example.org (Maarten D. de Jong) (2003-07-21)|
|Re: Recognising pointers during garbage collection? email@example.com (Sven Gohlke) (2003-07-23)|
|Re: Recognising pointers during garbage collection? firstname.lastname@example.org (Joachim Durchholz) (2003-07-23)|
|Re: Recognising pointers during garbage collection? email@example.com (2003-07-25)|
|Re: Recognising pointers during garbage collection? firstname.lastname@example.org (Dobes Vandermeer) (2003-07-25)|
|Re: Recognising pointers during garbage collection? email@example.com (Fergus Henderson) (2003-07-25)|
|Re: Recognising pointers during garbage collection? firstname.lastname@example.org (Joachim Durchholz) (2003-07-25)|
|Re: Recognising pointers during garbage collection? email@example.com (Marcin 'Qrczak' Kowalczyk) (2003-07-25)|
|[7 later articles]|
|From:||Sven Gohlke <firstname.lastname@example.org>|
|Date:||23 Jul 2003 10:37:29 -0400|
|Organization:||Individual Network Berlin e.V.|
|Posted-Date:||23 Jul 2003 10:37:29 EDT|
Maarten D. de Jong wrote:
> I am planning on getting my hands dirty with compiler design and language
> construction in a few months, and I have dutifully lurked this group for
> anything related to this topic. Through lots of reading, I have came
> across the concept of 'garbage collection'. Now while I think that I have
> some idea of the various algorithms involved (reference counting,
> mark/sweep, and various others), I do not really understand some of the
> implementation technicalities. The most baffling is the fact that many of
> these algorithms rely on hunting down pointers---but how do you recognise
> one? The documen- tation accompanying Boehm's celebrated program
> cryptically states that 'pointers of course look like pointers', but this
> is 'of course' circular reasoning.
Why don't you look into the source? And why do you want to reimplement a
garbage collector if you have an established implementation. Use the Boehm
implementation (and if you find a bug or implement an extension distribute
it to the Boehm source).
> I realise there is probably no fool-proof way of detecting whether a bit-
> pattern is a pointer or not, and that consequently there is a lot of black
> magic and heuristics involved. Can someone explain some of the more common
> techniques in uncooperative languages (like C) or cooperative ones (which
> you design yourself)?
Cooperating languages always register pointer to the garbage collector and
allocate heap memory through the memory allocator of the garbage colector.
This is done transparent to the programmer, i.e., by the compiler.
In non cooperative languages the programmer has to do that.
Return to the
Search the comp.compilers archives again.