comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeff C r e e.m" <jcreem@yahoo.com>
Subject: Re: large arrays
Date: Wed, 10 Nov 2004 12:47:41 GMT
Date: 2004-11-10T12:47:41+00:00	[thread overview]
Message-ID: <J5okd.390382$D%.378910@attbi_s51> (raw)
In-Reply-To: pan.2004.11.10.03.45.48.808299@linuxchip.demon.co.uk.uk.uk


"Dr. Adrian Wrigley" <amtw@linuxchip.demon.co.uk.uk.uk> wrote in message 
news:pan.2004.11.10.03.45.48.808299@linuxchip.demon.co.uk.uk.uk...
> On Tue, 09 Nov 2004 23:55:00 +0000, Jeff C r e e.m wrote:
>
>> From the GNAT RM (6.2)
>>
>>  The largest Size value permitted in GNAT is 2**31-1. Since this is a 
>> Size
>> in bits, this corresponds to an object of size 256 megabytes (minus one).
>> This limitation is true on all targets. The reason for this limitation is
>> that it improves the quality of the code in many cases if it is known 
>> that a
>> Size value can be accommodated in an object of type Integer.
>
> This is a real pain sometimes!  The limitation crops up in various
> annoying places, even in code you thought worked (eg generic 
> instantiatian?).
>
> There are rules that allow you to work with large objects, for example
>  Don't use 'Size - it doesn't work
>  Don't declare types > 256MB with static sizes
>
> Try something like:
>  type Site         is array (1..3) of Short_Short_Integer; -- size=24 bits
>  type Site_Matrix  is array (Integer range <>, Integer range <>) of Site;
>  type Site_Matrix_A is access Site_Matrix;
>  My_Array: Site_Matrix_A := new Site_Matrix(1..1_132_000,1..72);
>
> One area this I have encountered this is with image processing,
> where even standard IMAX frames might be 6144x4096 pixels, held
> as floating point RGBA come to about 400MB.
>
> Currently, I have a record of 1800MB, which I mmap into a file
> for shared access and persistence.  This works extremely well, other
> than having to calculate 'Size by another method.
>
> I'm a bit disappointed to hear that the restriction exists even
> on 64-bit targets - at the moment, I have 6GB RAM+Swap, and it is
> annoying that I can only access 5% of that with any single object
> in Ada.
>


What you mean to say is that it is annoying that you can only access 5% of 
that object in GNAT...This is not "an Ada thing" (although I strongly
suspect that on 32 bit targets that many compilers have this restriction (or 
perhaps a limit at 2x the GNAT restriction).

I don't believe there is any such restriction in the LRM.

I suspect if a supported customer or two complained then GNAT would be 
(eventually) changed. You could try putting in a bug report for the FSF 
version of GCC as a non-supported customer and see what happens. (Of course 
it is probably worth checking that the restriction still exists but it 
appears to (based on the documentation) for the latest released version of 
GCC)
http://gcc.gnu.org/onlinedocs/gcc-3.4.3/gnat_rm/Size-Clauses.html#Size-Clauses





  parent reply	other threads:[~2004-11-10 12:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-09 19:49 large arrays Joel Lepinoux
2004-11-09 23:55 ` Jeff C r e e.m
2004-11-10  3:45   ` Dr. Adrian Wrigley
2004-11-10  3:57     ` Brian May
2004-11-10 12:47     ` Jeff C r e e.m [this message]
2004-11-10  5:03   ` Steve
2004-11-10 12:41     ` Jeff C r e e.m
2004-11-11  0:07   ` Randy Brukardt
replies disabled

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