comp.lang.ada
 help / color / mirror / Atom feed
From: "Jonas Nygren" <ehsjony@ehs.ericsson.se>
Subject: for S'Storage_Size ...
Date: 1997/02/16
Date: 1997-02-16T00:00:00+00:00	[thread overview]
Message-ID: <01bc1c0e$bf67c4e0$829d6482@joy.ericsson.se> (raw)



I have a program that uses 'for S'Storage_Size use XXX' and Gnat
(3.09 Win95 and Solaris) generates Storage_Error before I have 
used up the storage that I have specified.

It could be that it is a bug in Gnat or, perhaps more likely, a bug
in my code. What is wrong with my code?

      task type Sub_Task is
         entry Dummy;
      end Sub_Task;

      type Sub_Task_Ref is access Sub_Task;
      for Sub_Task_Ref'Storage_Size use 
	Max_Sub_Tasks * Sub_Task'Max_Size_In_Storage_Elements;
.....
      A_Sub_Task : Sub_Task_Ref;
      Task_Count : Integer := 0;
   begin
      loop
	 exit when Task_Count = Max_Sub_Tasks;
         A_Sub_Task := new Sub_Task;
	 Task_Count := Task_Count + 1;
      end loop;

A Storage_Error will be generated when the fourth Sub_Task is allocated!

If I change the 'for ... use ...' to add an extra 5 byte per Sub_Task
object all works as expected. What could be wrong?

/jonas




             reply	other threads:[~1997-02-16  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-02-16  0:00 Jonas Nygren [this message]
1997-02-17  0:00 ` for S'Storage_Size Robert Dewar
1997-02-17  0:00 ` Mats Weber
replies disabled

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