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?
Asked
Active
Viewed 2,131 times
1
-
Just a point on Semantics, "call stack" usually refers to the list of functions that make up the context for a function call. The memory valid for the context of a call is simply the stack. – RedBlueThing Mar 09 '09 at 08:55
-
Actually, the term 'stack' is an outdated term. 'Call stack' encompasses the entire context of the current call (ie local variables and parameters) see http://www.programmingforums.org/thread8786.html#9 – Adam Naylor Mar 09 '09 at 09:35
4 Answers
4
-
This is was very helpful, although it didn't fix the problem. Further investigation needed :( – Adam Naylor Mar 09 '09 at 08:54
-
-
http://stackoverflow.com/questions/614842/why-does-this-code-corrupt-memory, already answered but setting the stack size hasn't fixed the problem so your thoughts would be appreciated – Adam Naylor Mar 09 '09 at 09:43
1
You can use the /F compiler flag to set the default stack size, or specify it as the second parameter to the CreateThread function.

1800 INFORMATION
- 131,367
- 29
- 160
- 239
0
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

zeromus
- 1,648
- 13
- 14
0
Rather than mess with with the stack size, why don't you simply use a std::vector or even dynamically allocate an array yourself?