A stack setting of 4GB? That is probably not doing much good. Try setting it to 100MB. If you get a stack overflow on use of an array, a temporary copy of the array is being created. The stack is just a reserved section of virtual memory, but the total is fixed by the linker.