home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!mcsun!sunic!ericom!falcon!jonas
- From: jonas@beppe.ericsson.se (Jonas Nygren)
- Subject: Re: Garbage Collection for C++
- Message-ID: <1992Aug17.074855.24336@ericsson.se>
- Sender: news@ericsson.se
- Nntp-Posting-Host: falcon.ericsson.se
- Reply-To: jonas@beppe.ericsson.se
- Organization: Ericsson Telecom AB
- References: <1992Aug16.052233.23166@ucc.su.OZ.AU>
- Date: Mon, 17 Aug 1992 07:48:55 GMT
- Lines: 40
-
- In article 23166@ucc.su.OZ.AU, maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
- > In article <1992Aug15.005542.3104@news.mentorg.com> bcannard@hppcb36.mentorg.com (Bob Cannard @ PCB x5565) writes:
- > >
- > >Reference counting suffers serious drawbacks:
- > >
- > >1. It can't handle cyclic data structures
- > >
- > >2. It is one of the most inefficient forms of garbage collection known to man.
- > >
- > >The main reason I'm pushing for true garbage collection is that I consider
- > >reference counting (which I already have) to be an unacceptably poor solution.
- >
- > Mm. Reference counting used to implement 'write on demand' in
- > copy contructors is supposedly inefficient. But this is not at all
- > the same as reference counting for garbage collection. In copy contructors,
- > you have to check the reference count before each write operation,
- > and if its not 1, clone off a copy of the object. Thats slow.
- >
- > But for GC you only have to increment the reference count
- > when you take the address of the object to form a GC pointer,
- > decrement it when the pointer is destroyed, and destroy the
- > object when the count goes to 0. That doesn't seem to be so slow
- > to me: please correct me if I'm wrong.
-
- Wouldn't even a GC scheme have to create a copy of the object if the pointer was
- used for non-const operations on the object? The advantage with implementing
- GC pointers as separate constructs is that the programmer can decide when he
- wants stucture sharing and whe he does not.
-
-
- > --
- > ;----------------------------------------------------------------------
- > JOHN (MAX) SKALLER, maxtal@extro.ucc.su.oz.au
- > Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
- > ;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
-
-
- /jonas
-
-
-