From: | "John R. Strohm" <strohm@airmail.net> |
Newsgroups: | comp.compilers |
Date: | 2 Jul 2003 00:39:36 -0400 |
Organization: | Compilers Central |
References: | 03-05-211 03-06-015 03-06-054 03-06-057 03-06-078 03-06-106 |
Keywords: | storage, GC |
Posted-Date: | 02 Jul 2003 00:39:36 EDT |
mwotton@cse.unsw.edu.au (Mark Alexander Wotton) wrote
> On 20 Jun 2003 00:02:55 -0400, Eric posted:
> > mwotton@cse.unsw.edu.au (Mark Alexander Wotton) wrote
> >>
> >> Either that, or only released when all references to it have passed
> >> out of scope. This is how many modern garbage-collected language
> >> implementations work.
> >
> > This scheme (reference-counting) is used in VB6 for instance.
>
> Reference counting and mark-and-sweep are just ways of implementing
> the basic idea of deallocating when references are out of scope.
The problem with reference-counting GC has been known for close to twenty
years that I personally know of. From the well-known "AI Koans":
One day a student came to Moon and said: "I understand how to make a better
garbage collector. We must keep a reference count of the pointers to each
cons."
Moon patiently told the student the following story:
"One day a student came to Moon and said: `I understand
how to make a better garbage collector...
[Pure reference-count garbage collectors have problems with circular
structures that point to themselves.]
Note that a doubly-linked list falls into this category...
Return to the
comp.compilers page.
Search the
comp.compilers archives again.