comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Large arrays (again), problem case for GNAT
Date: 13 Apr 2005 18:35:42 -0400
Date: 2005-04-13T18:35:42-04:00	[thread overview]
Message-ID: <wccr7heqp8h.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: pan.2005.04.13.12.46.52.518681@linuxchip.demon.co.uk.uk.uk

"Dr. Adrian Wrigley" <amtw@linuxchip.demon.co.uk.uk.uk> 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



  parent reply	other threads:[~2005-04-13 22:35 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-13 12:46 Large arrays (again), problem case for GNAT Dr. Adrian Wrigley
2005-04-13 13:10 ` Larry Kilgallen
2005-04-13 13:24   ` Alex R. Mosteo
2005-04-13 13:31   ` Marc A. Criley
2005-04-13 19:52 ` Jeffrey Carter
2005-04-13 19:54 ` Randy Brukardt
2005-04-13 22:01   ` (see below)
2005-04-14  0:16     ` Robert A Duff
2005-04-14  1:11       ` Alexander E. Kopilovich
2005-04-14  7:29         ` Dmitry A. Kazakov
2005-04-14  7:45           ` Duncan Sands
     [not found]           ` <1113464720.9829.20.camel@localhost.localdomain>
2005-04-14 13:59             ` Marius Amado Alves
2005-04-14 14:09               ` Dr. Adrian Wrigley
2005-04-14 14:40                 ` (see below)
     [not found]             ` <389d1596e98f95f0fdddc40afc0647b7@netcabo.pt>
2005-04-14 14:14               ` Duncan Sands
2005-04-14 15:18         ` Robert A Duff
2005-04-14 15:24           ` Robert A Duff
2005-04-15  5:21             ` Randy Brukardt
2005-04-15 11:49               ` Dr. Adrian Wrigley
2005-04-15 13:21                 ` Dmitry A. Kazakov
2005-04-15 14:31                   ` Dr. Adrian Wrigley
2005-04-15 14:57                     ` Dmitry A. Kazakov
2005-04-14 15:39           ` Dr. Adrian Wrigley
2005-04-14 15:48           ` Dmitry A. Kazakov
2005-04-14 21:19             ` Robert A Duff
2005-04-15  8:23               ` Dmitry A. Kazakov
2005-04-15  8:38                 ` Duncan Sands
2005-04-15  9:16                   ` Dmitry A. Kazakov
2005-04-15 18:30               ` Mark Lorenzen
2005-04-15 19:06                 ` Robert A Duff
     [not found]       ` <iSSDSN2L04G1@VB1162.spb.edu>
2005-04-14  7:34         ` Duncan Sands
2005-04-13 22:35 ` Robert A Duff [this message]
2005-04-14 11:40   ` Dr. Adrian Wrigley
2005-04-14 10:44 ` Dr. Adrian Wrigley
2005-04-14 15:03   ` Robert A Duff
2005-04-14 16:46     ` Dmitry A. Kazakov
2005-04-14 18:30       ` Pascal Obry
2005-04-14 19:45         ` Dmitry A. Kazakov
  -- strict thread matches above, loose matches on Subject: below --
2005-04-13 13:52 Duncan Sands
2005-04-13 14:20 ` 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