comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adambeneschan@gmail.com>
Subject: Re: A simple question about the "new" allocator
Date: Tue, 12 Aug 2014 12:10:06 -0700 (PDT)
Date: 2014-08-12T12:10:06-07:00	[thread overview]
Message-ID: <4dba71e0-30c9-4e16-9edb-4e8b43acc2ab@googlegroups.com> (raw)
In-Reply-To: <DktGv.521654$Ro3.320929@fx13.iad>

On Tuesday, August 12, 2014 11:49:03 AM UTC-7, Shark8 wrote:
> 
> > procedure main is
> > begin
> >    loop
> >      declare
> >        Test : access Positive := new Positive;
> >      begin
> >        null;
> >      end;
> >    end loop;
> > end main;
> 
> I /think/ you can do it with a type definition on the inner-block:
> 
> declare
>    Type Inner_Access is not null access positive;
>    Test : Inner_Access := new Positive;
> begin
>    null;
> end;
> 
> The reason is that leaving the nested-block's scope should force the 
> deallocation of all Inner_Access types if I'm remembering the RM correctly.

No, I don't think that's correct.  When an access type is declared in a nested block, all objects allocated using that access type (and not already deallocated) are *finalized*, but deallocation isn't required.  I don't see anything in the RM that says the storage must be reclaimed.

                               -- Adam

  reply	other threads:[~2014-08-12 19:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-12  6:54 A simple question about the "new" allocator NiGHTS
2014-08-12  7:35 ` Dmitry A. Kazakov
2014-08-12 13:38   ` G.B.
2014-08-12 10:29 ` sbelmont700
2014-08-12 18:49   ` Shark8
2014-08-12 19:10     ` Adam Beneschan [this message]
2014-08-12 21:53       ` Niklas Holsti
2014-08-12 22:34         ` Adam Beneschan
2014-08-12 23:14           ` sbelmont700
2014-08-12 23:41             ` Adam Beneschan
2014-08-13  7:36               ` Dmitry A. Kazakov
2014-08-13 15:04                 ` Adam Beneschan
2014-08-13 20:32           ` Niklas Holsti
2014-08-12 15:10 ` Adam Beneschan
2014-08-12 16:07 ` Jeffrey Carter
2014-08-12 19:58   ` Robert A Duff
2014-08-12 17:51 ` NiGHTS
replies disabled

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