comp.lang.ada
 help / color / mirror / Atom feed
From: Craig Carey <research@ijs.co.nz>
Subject: Re: Memory limits in Ada where Fortran has none
Date: Mon, 07 Mar 2005 12:09:33 +1300
Date: 2005-03-07T12:09:33+13:00	[thread overview]
Message-ID: <bf2n21pi11c5r3kau9885d9d5khifnuhl7@4ax.com> (raw)
In-Reply-To: 1110125661.857477.251640@o13g2000cwo.googlegroups.com



I guess that the FORTRAN was leaving too little memory for the Ada 95
 program.


On 6 Mar 2005 08:14:21 -0800, "braver" <deliverable@gmail.com> wrote:

>My working solution is probably what you mean by access function.
...
>>From now on, I allocate data arrays longer than 256*256*1024 elements
>in Fortran.  As people guessed correctly, I use GNAT -- what else can I
>do on Linux, given I can't find a downloadable/trial copy of Rational
>Apex, even though IBM took over it?  As for patches -- anyone heard of
>a 32-bit 'Size / 'Storage_Size patch to GNAT?


I guess that allocating memory on the Ada 95 side is not needed.

Maybe a thin pointer to a not allocated huge array could be used. E.g.: 

   type AA is array (Positive range <>) of ...;
   type Huge is array AA (Positive)
   Type Huge_Ptr is access Huge;
   F : Heap_Array_Ptr := new ....    --  A fat array double pointer
   X : Huge_Ptr := unchecked conversion from (F (F'First));
      --  Upper bound range checking on indexing X is absent

When importing a FORTRAN array into Ada 95, there is a choice of:
* an allocated array, or
* a pointer to a not allocated array. If the size is not known then it
   can be an array that is too large to allocate.

A pointer to the 1st element of any array including a FORTRAN array is
converted to a super large array. That zaps the upper bound index
checking.

So adding pointers can be avoided using indexing.
(If not, then GNAT source code of the gcc.gnu.org package
"Interfaces.C.Pointers" could be adapted.)

Also, there is the GNAT linker options allowing the stack size and heap
 size to be altered. They are described in the GNAT User's Guide:

gnatmake ... -largs --stack=0x30000"

The GNAT Users guide says:

$ gnatlink hello -Xlinker --stack=0x10000,0x1000

"This set the stack reserve size to 0x10000 bytes and the stack commit
 size to 0x1000 bytes."

$ gnatlink hello -Xlinker --heap=0x10000,0x1000
"This set the heap reserve size to 0x10000 bytes and the heap commit size
 to 0x1000 bytes."


On 6 Mar 2005 14:13:13 -0800, Gerald wrote:
...
>You should dynamically allocate the big array:
...
Hmm


--  Craig Carey <research@ijs.co.nz>    Avondale, Auckland, New Zealand
--  Fairness checklist: http://www.ombudsman.on.ca/pdf/fairness_stds.pdf
--  Ada 95 mailing lists: http://www.ijs.co.nz/ada_95.htm





  parent reply	other threads:[~2005-03-06 23:09 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-06  0:54 Memory limits in Ada where Fortran has none braver
2005-03-06  1:09 ` Jeff C
2005-03-06  6:18   ` braver
2005-03-06  9:26     ` Martin Krischik
2005-03-06 16:14       ` braver
2005-03-06 16:28         ` Jeff C
2005-03-06 23:09         ` Craig Carey [this message]
2005-03-07  0:36           ` braver
2005-03-07  5:55           ` braver
2005-03-08  5:35             ` braver
2005-03-06 14:09     ` Stephen Leake
2005-03-06  9:33 ` Martin Krischik
2005-03-06 22:13 ` Gerald
2005-03-06 23:01 ` Dr. Adrian Wrigley
2005-03-07  0:31   ` braver
2005-03-07 12:47     ` Dr. Adrian Wrigley
2005-03-07  9:41   ` Martin Krischik
2005-03-07 11:59     ` Dr. Adrian Wrigley
2005-03-07 12:26       ` Martin Krischik
2005-03-07  0:05 ` Robert A Duff
2005-03-07 18:04   ` braver
2005-03-16 19:41     ` Robert A Duff
2005-03-17 18:49       ` Martin Krischik
2005-03-08 11:24   ` Dr. Adrian Wrigley
2005-03-09  3:39     ` Craig Carey
2005-03-16 17:39       ` Craig Carey
2005-03-16 19:51     ` Robert A Duff
2005-03-16 23:47       ` Dr. Adrian Wrigley
replies disabled

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