As your program executes, the amount of SRAM available ebbs and flows. As your definition of the array size increases, available SRAM shrinks to the point where the program can crash. You can get an approximation of the free memory using:
int freeMemory() {
int free_memory;
if ((int)__brkval == 0) {
free_memory = ((int)&free_memory) - ((int)&__heap_start);
} else {
free_memory = ((int)&free_memory) - ((int)__brkval);
free_memory += freeListSize();
}
return free_memory;
}
and call freeMemory() from within loop().