As I understand it the size of the stack and the size of the variables would be set by the compiler. Probably due to different compiler versions across the system. More expert people on this list would know more about this than I. When I had a similar problem the critical size changed between working on RedHat PC's (where I noticed the problem first) and the SUN workstations I also use (where the arrays had to be even larger) before the code broke. Jack Liddle On Mon, 13 Dec 2004, John Podesta wrote: > Jack, > > Yes, the program compiles but then I get a windows error message when > I run it. It runs fine when I use gcc on the sun workstation. I guess > I'll try dynamic memory allocation as you suggested, but I can't > understand why I have a problem running the program on the PC but > not on the Sun. Thanks for your help. > > John Podesta > > On Mon, 13 Dec 2004, Jack Liddle wrote: > > > 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 > >> > >> > > > > >