From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!mailrus!uflorida!gatech!hubcap!billwolf From: billwolf@hubcap.clemson.edu (William Thomas Wolfe,2847,) Newsgroups: comp.lang.ada Subject: Re: Garbage Collection Message-ID: <3868@hubcap.UUCP> Date: 14 Dec 88 03:26:25 GMT References: <6713@june.cs.washington.edu> Sender: news@hubcap.UUCP Reply-To: wtwolfe@hubcap.clemson.edu List-Id: >From article <6713@june.cs.washington.edu>, by klaiber@june.cs.washington.edu (Alexander Klaiber): > In article <8812131536.AA08238@galaxy.compass.com> worley@compass.UUCP (Dale Worley) writes: >>I will add that garbage collection is one of the greatest aids to >>readabilty and reliability, because it takes a complicated and >>error-prone part of programming (reclaiming storage) and eliminates it >>completely. I don't see storage reclamation as being complicated or error-prone, but maybe that's because I'm so accustomed to dealing with it that it comes almost automatically. Probably the most important reason, though, is that the ADT paradigm provides such a powerful mechanism for simplifying the situation. I'm doing an ADT implementation right now (mergeable priority queues implemented as binomial forests), and I find it hard to believe that anyone could sit there and do an ADT implementation without being able to visualize the structure in question as the code is being generated. Given that the implementor can visualize the structure, the process of destroying it seems trivial. > In article <3861@hubcap.UUCP> wtwolfe@hubcap.clemson.edu writes: >> No, this isn't structural sharing, because you are explicitly manipulating > > Call it what you want, the fact is that multiple references exist to one > object, thus making explicit (i.e. by the programmer) storage management > a nightmare and an unnecessary chore. GC deals with this situation easily. There's an even easier way to deal with it: *** Never let a pointer out of your sight *** Given that one is doing this, the question is reduced to managing local pointers to a local structure, which is quite easy. >> In this particular instance, it would be best to store the key by which >> a person could be identified (social security number, for example) in >> the list, and then using the key to retrieve the current address from >> the Person database. > > That is, if you are willing to willing to pay the cost for the additional > data base lookup (usually an O(log n) operation) Not necessarily. If all you're doing is insertions, deletions, and retrievals, a hashing implementation would give better results. > I didn't say it couldn't be done without (what I call) structure sharing, > I just wanted to point out that this would be a very intuitive approach > and would probably lead to a very readable code. I'd contest both claims; as a maintainer, I wouldn't want anything to get in the way of being able to pin down the state of that program precisely, with regard to both time AND SPACE. For one who is accustomed to being able to nail down the precise state of a program, code from which it is impossible to "complete the picture" is highly counterintuitive, and will probably wind up being rewritten. > The method of using key searches is, I believe, an unnecessary hack to > avoid multiple references. Why bother to include a full B-tree package > or such when we can do without? How can you possibly analyze the space complexity of your program when you can't pin down the precise status of every entity??? You can't just wave your hands and say "Well, I'm using this much space, plus there's a bunch of space that may or may not be occupied..."!! And let's not forget the pure hell of doing a time analysis given that you can be interrupted unpredictably for garbage collection, the timing and duration of which is totally beyond your control, particularly in that it depends on how much memory happens to be currently installed on the executing system!! > In my opinion, people tend to put too much emphasis on plain efficiency of > their programs and too little on issues such as readability, reliability > and extensibility At last, something we can ALL agree on. (I hope...!) Bill Wolfe wtwolfe@hubcap.clemson.edu