From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,eb896440a3af23cf X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.glorb.com!wns14feed!worldnet.att.net!attbi_s51.POSTED!53ab2750!not-for-mail From: "Jeff C r e e.m" Newsgroups: comp.lang.ada References: Subject: Re: large arrays X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original Message-ID: NNTP-Posting-Host: 24.147.74.171 X-Complaints-To: abuse@comcast.net X-Trace: attbi_s51 1100090857 24.147.74.171 (Wed, 10 Nov 2004 12:47:37 GMT) NNTP-Posting-Date: Wed, 10 Nov 2004 12:47:37 GMT Organization: Comcast Online Date: Wed, 10 Nov 2004 12:47:41 GMT Xref: g2news1.google.com comp.lang.ada:6113 Date: 2004-11-10T12:47:41+00:00 List-Id: "Dr. Adrian Wrigley" 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