Path: utzoo!attcan!telly!lethe!torsqnt!jarvis.csri.toronto.edu!mailrus!uwm.edu!gem.mps.ohio-state.edu!usc!ucsd!ucbvax!agate!shelby!vaxc!Teknowledge.COM!mwolf From: mwolf@Teknowledge.COM (Michael Wolf) Newsgroups: comp.sw.components Subject: Re: Vagueness [was Re: Garbage Collection & ADTs] Message-ID: <282@alfred.Teknowledge.COM> Date: 22 Sep 89 00:26:16 GMT References: <900@scaup.cl.cam.ac.uk> <6530@hubcap.clemson.edu> <11885@polya.Stanford.EDU> Reply-To: mwolf@Teknowledge.COM (Michael Wolf) Organization: Cimflex Teknowledge Corp., Palo Alto CA Lines: 33 In article <11885@polya.Stanford.EDU> maslen@Polya.Stanford.EDU (Thomas Maslen) writes: >My guess is that any ADA solutions we see to my hypothetical problem >will involve auxiliary "appropriate ADTs" which are just limited >private types containing a pointer to the reference-counted real ADT. I don't see what the problem is with passing around private types with pointers to reference-counted ADT's. It adds a small amount of overhead to pointer references, and a couple bytes per object for reference counts. If you've got a language which enforces the "private" part, you're pretty damn sure that your reference count is correct, and it's then easy to tell when it is or isn't okay to deallocate an object. The only thing you need is a destructor routine called on each "private" pointer when it goes out of scope or get's deallocated. The nice thing about this approach is that you KNOW that garbage collection isn't going to unpredicatably impact your performance. Now, if you can find a GC algorithm that's as efficient, I'll consider switching. Also, I don't see that writing such a reference counting ADT is all that much tougher then writing the same ADT without the reference counting, so it doesn't take too much extra development time. There may be algorithms which require so many pointer references, and so little memory allocation/deallocation that a little GC would be more efficent, but I'm betting they're in the minority. Of course, it's possible to get applications where you can't afford the space overhead of a couple bytes per object, and then GC would be the way to go. Michael Wolf These opinions are bootleg from Taiwan, so it comes mwolf@Teknowledge.COM as no surprise to find that they're defective.