The sample code you pointed to allocates several arrays on the stack used by main(). In the example, these arrays are fairly “small”.
By increasing batch_size, m, and n you are making the stack allocations “large”, which cause the available stack space to be exceeded, which triggers the exception you observe.
 Placing large allocation in the stack is typically considered bad practice. Large allocations are usually allocated in the heap; use malloc() or equivalent functions to allocate data there.
 Use compiler switches to increase the default stack size. As I recall in MSVC there is a compiler switch /F to do that and also a linker switch /STACK. I forget whether one is a subset of the other, or whether they are true alternatives.