Re: Recognising pointers during garbage collection?

Sven Gohlke <sven@clio.in-berlin.de>
23 Jul 2003 10:37:29 -0400

          From comp.compilers

Related articles
Recognising pointers during garbage collection? cymric73@hotmail.com (Maarten D. de Jong) (2003-07-21)
Re: Recognising pointers during garbage collection? sven@clio.in-berlin.de (Sven Gohlke) (2003-07-23)
Re: Recognising pointers during garbage collection? joachim.durchholz@web.de (Joachim Durchholz) (2003-07-23)
Re: Recognising pointers during garbage collection? ftu@fi.ruu.nl (2003-07-25)
Re: Recognising pointers during garbage collection? dobes@dobesland.com (Dobes Vandermeer) (2003-07-25)
Re: Recognising pointers during garbage collection? fjh@cs.mu.oz.au (Fergus Henderson) (2003-07-25)
Re: Recognising pointers during garbage collection? joachim.durchholz@web.de (Joachim Durchholz) (2003-07-25)
Re: Recognising pointers during garbage collection? qrczak@knm.org.pl (Marcin 'Qrczak' Kowalczyk) (2003-07-25)
[7 later articles]
| List of all articles for this month |
From: Sven Gohlke <sven@clio.in-berlin.de>
Newsgroups: comp.compilers
Date: 23 Jul 2003 10:37:29 -0400
Organization: Individual Network Berlin e.V.
References: 03-07-149
Keywords: GC
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.
--
Best Regards
Sven



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.