Path: utzoo!attcan!uunet!mcsun!ukc!cam-cl!scc
From: scc@cl.cam.ac.uk (Stephen Crawley)
Newsgroups: comp.sw.components
Subject: Re: Garbage Collection & ADTs
Message-ID: <924@scaup.cl.cam.ac.uk>
Date: 27 Sep 89 22:14:27 GMT
References: <911@scaup.cl.cam.ac.uk> <6589@hubcap.clemson.edu> <2079@hydra.gatech.EDU> <8012@cbmvax.UUCP>
Sender: news@cl.cam.ac.uk
Organization: U of Cambridge Comp Lab, UK
Lines: 18

Randell Jesup writes:

> But GC is unlikely to reclaim that storage.  Yes, the graph no longer
> has pointers to the disconnected subgraph.  However, the subgraph may be
> circular (you said it was cyclic), so all the nodes of the subgraph may still
> have references to them.  Can current GC systems recognize such a loop and
> remove it in it's entirety?

Of course.  Only brain-dead garbage collectors that rely exclusively on
reference counts can't get rid of cycles.  (Reference counting garbage
collectors are bad news anyhow, since they entail the overhead of a ref
count inc/dec on every assignment.)

> How complex can such a loop be and still be recognized?

Arbitrarily complex.

-- Steve