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!seismo!sundc!pitstop!sun!decwrl!labrea!rutgers!gatech!hubcap!billwolf From: billwolf@hubcap.clemson.edu (William Thomas Wolfe,2847,) Newsgroups: comp.lang.ada Subject: Re: Garbage Collection Message-ID: <3832@hubcap.UUCP> Date: 11 Dec 88 19:11:52 GMT References: <124000026@inmet> Sender: news@hubcap.UUCP Reply-To: wtwolfe@hubcap.clemson.edu List-Id: >From article <124000026@inmet>, by ron@inmet.UUCP: > > Garbage collection certainly does not come for free, but it is extremely > useful. It frees the programmer from the need to repeatedly write > sophisticated ADT deallocate routines and to deal with the potentially > massive book-keeping requirements for determining whether an object is in > fact garbage. In general, lack of GC forces a programmer to invest a lot of > effort addressing issues that are not fundamentally related to the problem > domain. My experience has also shown that problems of "slow heap leakage" > are among the hardest errors to correct. "Repeatedly" write sophisticated ADT deallocate routines?? The basic idea is to write an ADT once and use it forever (i.e., until the next language modification :-) ); where does "repeatedly" come in? Dealing with the details of allocation requires as much effort as dealing with deallocation. Perhaps you would say that any maintenance of the structure used to represent your ADT is not fundamentally related to the problem domain. If so, I will have to disagree. ADTs, and computer programs in general, are characterized by both time complexity and space complexity. Making the tradeoffs between these forms of complexity is one of the most fundamental questions a programmer must deal with. This is the topic of much, if not most, of the literature regarding ADTs. Also, I disagree with the claim that a lot of effort is involved; in my experience, DESTROY routines are among the easiest to code. Usually, the ADT is defined recursively, lending itself to a very easy recursive destruction procedure; after that, just destroy any sub-ADTs in your descriptor, and from there it only takes one line of code to blow away the descriptor. About the hardest part of the whole process is the tedium of looking through to see what fields are user-defined sub-ADTs, since they have to be explicitly destroyed due to Ada's lack of integration between UNCHECKED_DEALLOCATION and user-defined DESTROY procedures. Bill Wolfe wtwolfe@hubcap.clemson.edu