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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,aa2e415128e40fff X-Google-Attributes: gid103376,public From: matthew_heaney@acm.org (Matthew Heaney) Subject: Re: Question about garbage collection Date: 1998/04/18 Message-ID: #1/1 X-Deja-AN: 345505989 Content-Transfer-Encoding: 8bit References: <6h851g$sq$1@news.tm.net.my> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Organization: Network Intensive Newsgroups: comp.lang.ada Date: 1998-04-18T00:00:00+00:00 List-Id: In article <6h851g$sq$1@news.tm.net.my>, "Centaury" wrote: >One question about access type garbage collection. >I understand that when an access object is no longer pointed at by an access >variable, the space taken by object would usually be reclaimed. >One question. . if the object itself is a record that has an access type in >it, and that object is pointing at another object, but not pointed at; would >it be considered lost and would the space be reclaimed?? > >Let me put it in illustration: > >head --> ("myname",link) --> ("yourname", link) --> null > ^ > | > | > ("hisname", link) -->null > >will the space resided by ("hisname", link) be recovered by garbage >collector?? Ada the language is designed to permit inclusion of a garbage collection, but few implementations of Ada have a garbage collector. (The only one I know about is the AppletMagic tool from Intermetrics.) So, reclaimation of objects on the heap is not done automatically. (However, objects on the stack are reclaimed automatically, as usual.) In your example, none of the objects on the heap will get reclaimed automatically, although I don't completely understand your example. Here's another one: type Integer_Access is access all Integer; procedure Allocate is IP : constant Integer_Access := new Integer; begin null; end; When you exit the scope of Allocate, you'll have generated some garbage, because you allocated an Integer object on the heap, and there aren't any access objects designating the object.