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 15:34:14 -0700 (PDT)
Date: 2014-08-12T15:34:14-07:00	[thread overview]
Message-ID: <b94a1432-123d-478e-adce-06432eccf4d5@googlegroups.com> (raw)
In-Reply-To: <c4vgm3Fc85cU1@mid.individual.net>

On Tuesday, August 12, 2014 2:53:36 PM UTC-7, Niklas Holsti wrote:

> It seems to me that if an access type is declared in a block, then
> completion of the block should by these rules cause the collection of
> that access type, being an "object implicitly declared" in the block, to
> cease to exist. For ordinary objects explicitly declared in a block, I
> certainly expect the object's storage to be reclaimed when the object
> ceases to exist on block exit; why should this not apply also to a
> collection object, even if its declaration is implicit?

I see your point.  But unless I've missed something, it's not an RM requirement.

However, if Storage_Size is specified for an access type, I think that the program does have to allocate a pool just for that type, and the storage for the pool does get reclaimed when the block is left.  (13.11(18))  The difference is that when Storage_Size is specified, the expectation is that the program will allocate a contiguous block of memory of that size to be used for allocations for that access type, and that storage block can simply be reclaimed all at once.  If Storage_Size is not specified, there won't be any such contiguous block. 

> I have not found an explicit requirement on reclaiming the storage of a
> collection in the Ada 2012 RM. As I remember, the Ada 83 RM had some
> more explicit text about this, and I remember testing that it worked
> (the collection's storage was reclaimed) with DEC Ada on a VAX.

I can't find anything explicit like this in the Ada 83 RM, even if Storage_Size is specified.

                            -- Adam

  reply	other threads:[~2014-08-12 22:34 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
2014-08-12 21:53       ` Niklas Holsti
2014-08-12 22:34         ` Adam Beneschan [this message]
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