-
killed message
I need a really large array to conduct a
series of calculations. When I declare...
int Uq[5764801][3];
...my program compiles without warning or error (regardless of whether I actually include the calculation in the program or delete it).
When I execute the program, I get an error message "killed" on the screen.
Obviously the array is too big. How do I get C to handle extremely large arrays?
THANKS,
-Prof D
-
Are you sure you need such a big array? And are you sure thats the exact number you need? Why dont you creat some variable/struct and just allocate the memory when needed so you dont over use memory, you only use what you need. Show us your code and we may give you other alternatives.
-
int Uq[5764801][3]; = 69177612 bytes
If you're declaring this array in a function (including main) then 69177612 bytes is going to be allocated from the stack. So it looks like you're out of stack, increase the stack size or make it a global.
Or as stumon said, allocate the memory.
-
killed message
Thanks my friends. Following stumon's suggestions, I simply broke the program into 7ths and ran each large array separately.
I'll save the other suggestions for the future. They're insightful.
-Prof D
p.s. Sorry about not responding sooner, I had problems getting on the c-programming page.