comp.lang.ada
 help / color / mirror / Atom feed
From: matthew_heaney@acm.org (Matthew Heaney)
Subject: Re: Question about garbage collection
Date: 1998/04/18
Date: 1998-04-18T00:00:00+00:00	[thread overview]
Message-ID: <matthew_heaney-ya023680001804981800550001@news.ni.net> (raw)
In-Reply-To: 6h851g$sq$1@news.tm.net.my


In article <6h851g$sq$1@news.tm.net.my>, "Centaury" <utopian@tm.net.my> 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.




  reply	other threads:[~1998-04-18  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-04-18  0:00 Question about garbage collection Centaury
1998-04-18  0:00 ` Matthew Heaney [this message]
1998-04-19  0:00   ` Ed Falis
1998-04-19  0:00     ` Robert Dewar
1998-04-20  0:00       ` Fergus Henderson
1998-04-20  0:00         ` Robert Dewar
1998-04-21  0:00           ` raw
     [not found]         ` <ErqJro.9BI@world.std.com>
1998-04-21  0:00           ` Robert Dewar
1998-04-21  0:00             ` William Tanksley
     [not found]               ` <ErvsM0.Bu7@world.std.com>
1998-04-24  0:00                 ` Robert Dewar
     [not found]                   ` <Es39LE.B5o@world.std.com>
1998-04-28  0:00                     ` Robert Dewar
1998-04-24  0:00               ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox