What reason may cause stack overflow?

Hi all,
I am developing a program with recursion. I met stack overflow even if the depth of recursion is only two.
The biggest data in my function is automatic array,but they should be stored in global memory not stack(local memory).
Hence I want to know what data will be stored in the stack.

Show the relevant code instead of describing it. Working hypothesis for now is that the code does allocate a thread-local array that is placed on the thread-local stack, causing a stack overflow.