comp.lang.ada
 help / color / mirror / Atom feed
* Large arrays in GNAT
@ 2000-07-16  0:00 Reinert Korsnes
  2000-07-16  0:00 ` Jeff Creem
  2000-07-16  0:00 ` gdemont
  0 siblings, 2 replies; 4+ messages in thread
From: Reinert Korsnes @ 2000-07-16  0:00 UTC (permalink / raw)


Hi,

I cannot declare an array of Float larger than 2.5 mill elements
using my Ada95 gnat compiler (gnat-3.12p-12) on my linux box.

For example:

A : array (Integer range 1 .. 2_500_000) of Float;

results in "Segmentation fault (core dumped)".

For info: In Fortran (g77) I can declare much larger (Real) arrays.

Are there any options available under gnat so I can use arrays
of for example 5 mill elements of Float ?

reinert

--
Norwegian Polar Institute
Polar Environment Center
N-9296 Tromso
Norway
Fax: +47 77750501

http://geophys.npolar.no/~reinert/personal.html







^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Large arrays in GNAT
  2000-07-16  0:00 Large arrays in GNAT Reinert Korsnes
  2000-07-16  0:00 ` Jeff Creem
@ 2000-07-16  0:00 ` gdemont
  1 sibling, 0 replies; 4+ messages in thread
From: gdemont @ 2000-07-16  0:00 UTC (permalink / raw)



> I cannot declare an array of Float larger than 2.5 mill elements
> using my Ada95 gnat compiler (gnat-3.12p-12) on my linux box.

> A : array (Integer range 1 .. 2_500_000) of Float;

A is taken on the stack, so if the "exe" has a limit on that,
you have to extend this limit. A more comfortable way is to
allocate A in the heap - according to the OS, the only limit
is +/- the total user workspace in virtual memory (4 GB on
a 32-bit system).

type vector is array (Integer range <>) of Float;
type vector_a is access vector;

A: vector_a:= New vector(1 .. 2_500_000);

HTH
______________________________________________________
Gautier  --  http://members.xoom.com/gdemont/gsoft.htm


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Large arrays in GNAT
  2000-07-16  0:00 ` Jeff Creem
@ 2000-07-16  0:00   ` Reinert Korsnes
  0 siblings, 0 replies; 4+ messages in thread
From: Reinert Korsnes @ 2000-07-16  0:00 UTC (permalink / raw)


You fixed my problem.   Thanks a lot....

reinert

Jeff Creem wrote:

> "Reinert Korsnes" <Reinert.Korsnes@npolar.no> wrote in message
> news:3971DC1F.D415BFBE@npolar.no...
> > Hi,
> >
> > I cannot declare an array of Float larger than 2.5 mill elements
> > using my Ada95 gnat compiler (gnat-3.12p-12) on my linux box.
> >
> > For example:
> >
> > A : array (Integer range 1 .. 2_500_000) of Float;
>
> declare the array in a package (spec or body it does not matter) or create
> an access type and do a new.
>
> If you declare an array as a local variable or (really the same thing) in
> the
> mainline procedure it gets created on the stack..

--
Norwegian Polar Institute
Polar Environment Center
N-9296 Tromso
Norway
Fax: +47 77750501

http://geophys.npolar.no/~reinert/personal.html







^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Large arrays in GNAT
  2000-07-16  0:00 Large arrays in GNAT Reinert Korsnes
@ 2000-07-16  0:00 ` Jeff Creem
  2000-07-16  0:00   ` Reinert Korsnes
  2000-07-16  0:00 ` gdemont
  1 sibling, 1 reply; 4+ messages in thread
From: Jeff Creem @ 2000-07-16  0:00 UTC (permalink / raw)



"Reinert Korsnes" <Reinert.Korsnes@npolar.no> wrote in message
news:3971DC1F.D415BFBE@npolar.no...
> Hi,
>
> I cannot declare an array of Float larger than 2.5 mill elements
> using my Ada95 gnat compiler (gnat-3.12p-12) on my linux box.
>
> For example:
>
> A : array (Integer range 1 .. 2_500_000) of Float;


declare the array in a package (spec or body it does not matter) or create
an access type and do a new.

If you declare an array as a local variable or (really the same thing) in
the
mainline procedure it gets created on the stack..








^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2000-07-16  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-07-16  0:00 Large arrays in GNAT Reinert Korsnes
2000-07-16  0:00 ` Jeff Creem
2000-07-16  0:00   ` Reinert Korsnes
2000-07-16  0:00 ` gdemont

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