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!news.mathworks.com!europa.eng.gtefsd.com!howland.reston.ans.net!ix.netcom.com!netcomsv!forte!mikes
From: mikes@forte.com (Mike Schilling)
Subject: Re: Reference Counting (was Re: Searching Method for Incremental Garbage Collection)
Message-ID: <1994Nov24.004702.19718@forte.com>
Organization: Forte Software Inc.
X-Newsreader: Tin 1.1 PL5
References: <milodCzov86.LyD@netcom.com>
Date: Thu, 24 Nov 1994 00:47:02 GMT
Lines: 31
Xref: glinda.oz.cs.cmu.edu comp.lang.c:117697 comp.lang.c++:100174 comp.lang.lisp:15790

John DiCamillo (milod@netcom.com) wrote:
: ichudov@wiltel.com (Igor Chudov) writes:
: 
: >Andrew Koenig (ark@research.att.com) wrote:
: >: In article <1994Nov21.181455.13457@isis.muc.de> Mike.Chapman@muc.de (Mike Chapman) writes:
: 
: >: > Almost any non trivial structure in the real world, 
: >: > if you are actually going to do anything with it,
: >: > needs back pointers (simple example - doubly linked lists) 
: >: > or pointers to parents (simple example - almost any tree structure)
: >: > or whatever.
: 
: >: Sure, but such pointers do not prevent reference counting from working.
: 
: >Can you give us a clue how you can make reference counting working with
: >circular references.
: 
: Well, one obvious solution is not to ref-count
: the back pointers.  This is pretty easy to do,
: since (in C++) you have to explicitly request
: ref-counting with a smart pointer or equivalent.
This assumes you can define back-pointer in such a way that:

	1. Sans back-pointers, there are no loops.
	2. A back-pointer will never be necessary to stop an object from being
	   freed, since some chain of forward pointers will reach the 
	   back-pointed-to object.

In general, this is quite hard to do.

Mike
