Array Size Limits

Jack Liddle j.liddle1@physics.ox.ac.uk
Mon Dec 13 12:08:00 GMT 2004


Not to sure what you mean by GCC won't run?  Does the program compile and
then seg fault when you run it?

I ran into a similar problem a few months ago (google for my name and
you'll see the posts).

Yes there is a limit to the size of your arrays can be when put on the
stack.

try instead

double *A;
A = malloc(500000*sizeof(double));

this should declare the array in the main bulk of your memory.  Then
access
A as per usual.

Jack Liddle
Rudolph Peierls Centre for Theoretical Physics
University Of Oxford

On Mon, 13 Dec 2004, John Podesta wrote:

> I installed MinGw on a pentiuim 4m laptop with 1G of RAM.
> Apparently GCC won't run when I make my array size too big.
> Is there some limit on the array size and is there any way for me
> to set it up so I can have large arrays, e.g., A[500000].
> Thanks.
>
> John Podesta
> NASA GSFC
>
>



More information about the Gcc-help mailing list