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 autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.182.230.168 with SMTP id sz8mr801369obc.9.1383305292431; Fri, 01 Nov 2013 04:28:12 -0700 (PDT) X-Received: by 10.182.226.231 with SMTP id rv7mr19211obc.21.1383305292382; Fri, 01 Nov 2013 04:28:12 -0700 (PDT) Path: border1.nntp.dca.giganews.com!nntp.giganews.com!o2no13647052qas.0!news-out.google.com!9ni3696qaf.0!nntp.google.com!o2no13647040qas.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 1 Nov 2013 04:28:12 -0700 (PDT) In-Reply-To: <79199f0f-7392-4509-9ada-2e3ef2920a83@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=150.101.201.124; posting-account=pBdvJAoAAAAbTiQ-L1tpxD99i_UttsrJ NNTP-Posting-Host: 150.101.201.124 References: <79199f0f-7392-4509-9ada-2e3ef2920a83@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: GNAT: Why does a large 'new' allocation blow the stack when an initialiser is present ? From: Rod Kay Injection-Date: Fri, 01 Nov 2013 11:28:12 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: number.nntp.dca.giganews.com comp.lang.ada:183773 Date: 2013-11-01T04:28:12-07:00 List-Id: On Friday, 1 November 2013 21:19:01 UTC+11, sbelm...@gmail.com wrote: >=20 > Don't necessarily assume they are on the heap. Allocators of anonymous a= ccess types work differently than those of named types. They are (or at le= ast can be) put on the stack instead of the heap, since they are (or at lea= st can be) reclaimed when the subprogram ends (13.11~25/2). >=20 Ah, thanks for the info, I was not aware of this. I changed the test code to use a named access type, tho it hasn't appear= ed to change the result. type Integer_array is array (Integer range <>) of Integer; type access_Integer_array is access Integer_array; =20 the_Array_1 : access_Integer_array=20 :=3D new Integer_array (1 .. 10_000_000); -- Fine. the_Array_2 : access_Integer_array :=3D new Integer_array' (1 .. 10_000_000 =3D> 5); -- Stack overflo= w.