I'm working from an example piece of code that allocates a relatively large local array. (32768 to be precise) When I try the same I'm getting behaviour that appears to be a stack overflow. Now I was wondering if my example has maybe set the stack to be larger then my application. Is this possible? if so how?
You can use the /F compiler flag to set the default stack size, or specify it as the second parameter to the CreateThread function.
Rather than mess with with the stack size, why don't you simply use a std::vector or even dynamically allocate an array yourself?
You could create a new thread for this work. You can generally specify the size of the stack when creating a thread, and certainly with vs2008's CreateThread()
function
来源:https://stackoverflow.com/questions/625416/can-you-set-the-size-of-the-call-stack-in-c-vs2008