comp.lang.ada
 help / color / mirror / Atom feed
From: Rod Kay <rodakay@internode.on.net>
Subject: GNAT: Why does a large 'new' allocation blow the stack when an initialiser is present ?
Date: Thu, 31 Oct 2013 19:49:20 -0700 (PDT)
Date: 2013-10-31T19:49:20-07:00	[thread overview]
Message-ID: <d843d1e1-a1ea-4818-b23d-aff833be2186@googlegroups.com> (raw)

Hi all,

   Is this a bug ?



procedure bug_Test
is
   type Integer_array is array (Integer range <>) of Integer;
   
   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 => <>);   -- Stack overflow.

begin 
   null;
end;


   It seems that, with the initialiser, GNAT is creating the array on the stack before copying it to the final heap memory ?


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

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-01  2:49 Rod Kay [this message]
2013-11-01  8:45 ` GNAT: Why does a large 'new' allocation blow the stack when an initialiser is present ? 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
replies disabled

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