Newsgroups: alt.lang.design,comp.lang.c,comp.lang.c++,comp.lang.lisp
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!howland.reston.ans.net!pipex!uunet!allegra!alice!ark
From: ark@research.att.com (Andrew Koenig)
Subject: Re: Reference Counting (was Re: Searching Method for Incremental Garbage Collection)
Message-ID: <D03Iwn.Jn5@research.att.com>
Organization: Software Engineering Research Department
References: <3bdd2v$ckg@larry.rice.edu> <3bgbv6$qmo@network.ucsd.edu>
Date: Wed, 30 Nov 1994 19:45:59 GMT
Lines: 33
Xref: glinda.oz.cs.cmu.edu comp.lang.c:118539 comp.lang.c++:101065 comp.lang.lisp:15873

In article <3bgbv6$qmo@network.ucsd.edu> mbk@inls1.ucsd.edu (Matt Kennel) writes:

> In my experience the problem with cyclical reference graphs is
> that they arise not only in the guts of a well-controlled library package
> or object (like the linked-tree/list examples presented) but more often
> in between data-structures in the user-written "main code."  When no
> one person or "module" can claim total reponsibility over the allocation
> of storage.

> Those are the hard ones.

Indeed.  In fact, garbage collection might not even handle them.

Consider, for example, an interpreter that uses two associative
data structures.  One maps identifiers to magic cookies that
represent memory locations; the other maps those locations to
the corresponding values.  This two-level approach, or something
like it, is needed if the interpreter is to handle lexical
scoping correctly.

Suppose that during execution, the value of one of these
cookes becomes unnecessary.  How does the interpreter know
that it can delete the corresponding entry from the second
associative data structure?  Or can it?

One can think of this problem as a kind of meta-garbage-collection.
It's hard to see how any programming language can know enough
about the application to solve it automatically.

I can imagine other similar examples.
-- 
				--Andrew Koenig
				  ark@research.att.com
