The stack is a limited resource for a reason, and it is likely that you are
using it inappropriately. Even so the amount of stack allocated to a process
in Windows is typically 2Mb, which is considerable. Changing the stack size is
unlikely to be an appropriate solution. If you have a stack overflow it will
either be because your code has a bug that needs fixing, or because of ill-
advised coding practices.
The most likely cause is creation of large local objects or arrays. If this is
the case you should use dynamic memory allocation or allocate the object
statically as appropriate. As a guide, use dynamic memory allocation for
transient objects or where the size or number of objects required is
determined at runtime, and use static allocation where a fixed known size or
number are required for the lifetime of the process execution, and where
reentrancy is not an issue.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am using the Bloodshed Dev-C++ compiler and am getting a stack overflow
error.
Does anyone know which compile /link flags i need to use in project options to
increase the stack size?
Thanks
Jefe
The stack is a limited resource for a reason, and it is likely that you are
using it inappropriately. Even so the amount of stack allocated to a process
in Windows is typically 2Mb, which is considerable. Changing the stack size is
unlikely to be an appropriate solution. If you have a stack overflow it will
either be because your code has a bug that needs fixing, or because of ill-
advised coding practices.
The most likely cause is creation of large local objects or arrays. If this is
the case you should use dynamic memory allocation or allocate the object
statically as appropriate. As a guide, use dynamic memory allocation for
transient objects or where the size or number of objects required is
determined at runtime, and use static allocation where a fixed known size or
number are required for the lifetime of the process execution, and where
reentrancy is not an issue.