A program includes two large arrays on a function (main
):
int array [1000][1000];
char anotherArray [1000][1000];
On Linux, it seems to work perfectly fine but on Windows the program crashes unless these arrays are moved to global scope.
It seems to be an OS-specific issue, what causes it?
Edit: this question is about the differences between both OSs
Answer
(as the question has been marked as duplicate, I can't answer it directly)
The reason is that the stack is used for local variables (as explained on the other answers on Stack Overflow); on Windows its size is 1 MB but on Linux it's 8 MB by default, so there's more space available.