From: "Dr. Adrian Wrigley" <amtw@linuxchip.demon.co.uk.uk.uk>
Subject: Re: large arrays
Date: Wed, 10 Nov 2004 03:45:25 GMT
Date: 2004-11-10T03:45:25+00:00 [thread overview]
Message-ID: <pan.2004.11.10.03.45.48.808299@linuxchip.demon.co.uk.uk.uk> (raw)
In-Reply-To: kNckd.488755$mD.84928@attbi_s02
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.
Of course there are those who might argue that there must something wrong
with the programming approach if objects get this large... but that's
another argument.
--
Dr. Adrian Wrigley, Cambridge, UK.
next prev parent reply other threads:[~2004-11-10 3:45 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 [this message]
2004-11-10 3:57 ` Brian May
2004-11-10 12:47 ` Jeff C r e e.m
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