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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,be7fa91648ac3f12 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.glorb.com!newscon02.news.prodigy.com!newscon06.news.prodigy.com!prodigy.net!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Large arrays (again), problem case for GNAT Date: 13 Apr 2005 18:35:42 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1113431742 20556 192.74.137.71 (13 Apr 2005 22:35:42 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Wed, 13 Apr 2005 22:35:42 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: g2news1.google.com comp.lang.ada:10442 Date: 2005-04-13T18:35:42-04:00 List-Id: "Dr. Adrian Wrigley" writes: > Hi guys! > > A month or two back I hinted that I had been having problems > the GNAT code accessing large data structures. It seemed that > incorrect code was silently being generated. Since I didn't > have a test case available, no progress could be made. > > I have encountered the problem again, and produced a test case. Interesting. I ran your program on windows XP professional, using GNAT version 5.03a, which is a supported version. It ran fine, and produced this output: First element attribute 1 Last element attribute 210000000 Address of first element is 02570020 Address of last element is 3468621C (Last element should be at higher address than first) Address of last element is 3468621C Writing to all elements in loop Writing to 'Last element It ran in a few seconds. I changed Size to 410_000_000, and it still worked fine (but took longer). At 510_000_000 the malloc failed. Why do you use malloc? Why didn't you write: Big := new Big_T; ? I'm not sure it makes any difference in this case, but in general, if you're going to play games with memory allocation, you should use storage pools, rather than relying on the hope that malloc returns something that the Ada compiler likes. If you had an access to unconstrained array, the malloc method would almost certainly fail, unless you wrap it in the proper storage pool thing. Also, I would think "access" should be "access all" if you're playing those games. I suspect your problem is an OS problem, and not a GNAT problem. - Bob