Newsgroups: alt.lang.design,comp.lang.c,comp.lang.c++,comp.lang.lisp,zer.z-netz.sprachen.algorithmen
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!uhog.mit.edu!sgiblab!pacbell.com!att-out!nntpa!nntpa.cb.att.com!lgm
From: lgm@polaris.ih.att.com (Lawrence G. Mayka)
Subject: Re: Reference Counting (was Re: Searching Method for Incremental Garbage Collection)
In-Reply-To: kxn3796@hertz.njit.edu's message of Tue, 22 Nov 1994 18:46:47 GMT
Message-ID: <LGM.94Nov25160315@polaris.ih.att.com>
Sender: news@nntpa.cb.att.com (Netnews Administration)
Nntp-Posting-Host: polaris.ih.att.com
Organization: AT&T Bell Laboratories, Naperville, Illinois, USA
References: <3ai2ol$3ua@gate.fzi.de> <AST.178.785265972@postman.hsn.no>
	<CzKAnH.D3@rheged.dircon.co.uk> <CzoCo6.FEB@cunews.carleton.ca>
	<1994Nov22.184647.8864@njitgw.njit.edu>
Date: Fri, 25 Nov 1994 22:03:15 GMT
Lines: 42
Xref: glinda.oz.cs.cmu.edu comp.lang.c:117902 comp.lang.c++:100372 comp.lang.lisp:15804

In article <1994Nov22.184647.8864@njitgw.njit.edu> kxn3796@hertz.njit.edu (Ken Nakata) writes:

   In article <CzoCo6.FEB@cunews.carleton.ca>,
   David F. Skoll <dfs@doe.carleton.ca> wrote:

   >In article <CzKAnH.D3@rheged.dircon.co.uk>, Simon Brooke
   >(simon@rheged.dircon.co.uk) wrote:

   >> Furthermore, programs which habitually create circular structures and
   >> then forget about them are (in my expreience) rare.

   >How about a binary tree where for convenience each node stores a pointer
   >to its parent as well as pointers to its children?  Pretty common.
   >How about doubly-linked lists?  Pretty common.

   It is not clear what he meant by "habitually create" "and then forget"
   about circular structure, but IMO, your examples do not "forget" about
   the circular structure, because usually you enforce some sort of
   *partial order* on the graph nodes (e.g. "Before a list node can be
   deleted, all its succeeding nodes must be deleted," or "before a tree
   node can be deleted, all its descendant nodes must be deleted," etc).
   A practical example would be (again) UNIX file system structure.

You, Andrew Koenig, and others are essentially describing techniques
for either =avoiding= circular, counted references or explicitly
=breaking= circular, counted references.  The statement which remains
fact is that reference counting cannot deal with the =general case= of
circular references; this is quite well-known in the literature.

You might call these "useful rules of sound design"; others might call
them "cumbersome, error-prone workarounds."  The point is that if you
believe (preferably through extensive experience with both paradigms)
that invisible, ubiquitous, automatic memory reclamation improves the
productivity and quality of your applications, reference-counting is
not usually the way to get it unless other considerations (e.g.,
choice of programming language) take precedence.
--
        Lawrence G. Mayka
        AT&T Bell Laboratories
        lgm@ieain.att.com

Standard disclaimer.
