comp.lang.ada
 help / color / mirror / Atom feed
From: Rod Kay <rodakay@internode.on.net>
Subject: Re: GNAT: Why does a large 'new' allocation blow the stack when an initialiser is present ?
Date: Fri, 1 Nov 2013 04:28:12 -0700 (PDT)
Date: 2013-11-01T04:28:12-07:00	[thread overview]
Message-ID: <b471e71a-ec5f-4bc6-83ba-d37c0ca918d3@googlegroups.com> (raw)
In-Reply-To: <79199f0f-7392-4509-9ada-2e3ef2920a83@googlegroups.com>

On Friday, 1 November 2013 21:19:01 UTC+11, sbelm...@gmail.com  wrote:
> 
> Don't necessarily assume they are on the heap.  Allocators of anonymous access types work differently than those of named types.  They are (or at least can be) put on the stack instead of the heap, since they are (or at least can be) reclaimed when the subprogram ends (13.11~25/2).
> 

   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 appeared to change the result.


   type        Integer_array is array (Integer range <>) of Integer;
   type access_Integer_array is access Integer_array;
   
   the_Array_1 : access_Integer_array 
      := new Integer_array  (1 .. 10_000_000);         -- Fine.

   the_Array_2 : access_Integer_array
      := new Integer_array' (1 .. 10_000_000 => 5);    -- Stack overflow.


      reply	other threads:[~2013-11-01 11:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-01  2:49 GNAT: Why does a large 'new' allocation blow the stack when an initialiser is present ? Rod Kay
2013-11-01  8:45 ` Simon Wright
2013-11-01 11:23   ` Rod Kay
2013-11-01 15:04   ` Georg Bauhaus
2013-11-01 10:19 ` sbelmont700
2013-11-01 11:28   ` Rod Kay [this message]
replies disabled

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