home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal
- From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
- Subject: Re: Garbage Collection for C++
- Message-ID: <1992Aug15.154818.12396@ucc.su.OZ.AU>
- Sender: news@ucc.su.OZ.AU
- Nntp-Posting-Host: extro.ucc.su.oz.au
- Organization: MAXTAL P/L C/- University Computing Centre, Sydney
- References: <1992Aug6.014619.2111@ucc.su.OZ.AU> <DAVEG.92Aug13025629@synaptx.synaptics.com> <1992Aug14.021547.15215@news.mentorg.com>
- Date: Sat, 15 Aug 1992 15:48:18 GMT
- Lines: 48
-
- In article <1992Aug14.021547.15215@news.mentorg.com> bcannard@hppcb36.mentorg.com (Bob Cannard @ PCB x5565) writes:
- >
- >In article <DAVEG.92Aug13025629@synaptx.synaptics.com>, daveg@synaptics.com (Dave Gillespie) writes:
- >
- >This would accord with existing C++ philosophy, but I don't see how
- >you could make a GC that's immune to dangling pointers. Anyone out
- >there know otherwise?
-
- GC objects would be immune to dangling GC pointers.
- If a GC pointer is rooted (exists non-circularly) then the object
- wont get deleted when you say 'delete'. The pointer gets
- zeroed out though.
-
- >
- >|> What if you have virtual base classes, and there are only references
- >|> to the base part of an object? The derived part of the object has
- >|> a pointer to the base part but not the other way around, so the
- >|> derived part might be collected in this case. Can this ever be a
- >|> problem?
- >
- >I don't think so, but I don't know the mechanics of inheritance (and in
- >particular MI) well enough to say. Comments from those who know the
- >dirty details of inheritance welcome!
-
- This is a major problem. Specifically, if an exact object
- is GC, then all its accessible base classes must be too. INcluding
- the abstract ones. This will tend to partition programs into
- a GC part and a non-GC part. In particular, the GC mechanism
- must be able to 'downcast' from a GC objects base to the actual
- object like a virtual destructor can, and for the same reason.
-
- As far as I can see, all pointers to GC objects must
- be GC pointers. And all pointers INTO them too. Otherwise
- you can 'delete' via an ordinary pointer, and an ordinary
- pointer could dangle.
-
- This makes the GC kernel secure, and allows outwards
- references to non-GC objects. All inwards references have to be
- GC pointers.
-
- In this system it is imperative that GC pointers in
- ordinary objects be properly destroyed.
-
- --
- ;----------------------------------------------------------------------
- JOHN (MAX) SKALLER, maxtal@extro.ucc.su.oz.au
- Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
- ;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
-