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.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.42.35.10 with SMTP id o10mr419384icd.6.1407870607714; Tue, 12 Aug 2014 12:10:07 -0700 (PDT) X-Received: by 10.50.44.18 with SMTP id a18mr24829igm.12.1407870607336; Tue, 12 Aug 2014 12:10:07 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!h18no19042586igc.0!news-out.google.com!px9ni588igc.0!nntp.google.com!h18no19042581igc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 12 Aug 2014 12:10:06 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.126.103.122; posting-account=KSa2aQoAAACOxnC0usBJYX8NE3x3a1Xq NNTP-Posting-Host: 66.126.103.122 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <4dba71e0-30c9-4e16-9edb-4e8b43acc2ab@googlegroups.com> Subject: Re: A simple question about the "new" allocator From: Adam Beneschan Injection-Date: Tue, 12 Aug 2014 19:10:07 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:21689 Date: 2014-08-12T12:10:06-07:00 List-Id: On Tuesday, August 12, 2014 11:49:03 AM UTC-7, Shark8 wrote: >=20 > > procedure main is > > begin > > loop > > declare > > Test : access Positive :=3D new Positive; > > begin > > null; > > end; > > end loop; > > end main; >=20 > I /think/ you can do it with a type definition on the inner-block: >=20 > declare > Type Inner_Access is not null access positive; > Test : Inner_Access :=3D new Positive; > begin > null; > end; >=20 > The reason is that leaving the nested-block's scope should force the=20 > deallocation of all Inner_Access types if I'm remembering the RM correctl= y. No, I don't think that's correct. When an access type is declared in a nes= ted block, all objects allocated using that access type (and not already de= allocated) are *finalized*, but deallocation isn't required. I don't see a= nything in the RM that says the storage must be reclaimed. -- Adam