Setting the stack size

Franciszek Czekala home at valentimex.com
Fri Dec 3 08:23:54 PST 2010


Thank you for the information (I should have mentioned that I am
interested in Windows). I suspected it should be done via linker
and found the /STACK option in optlink info but I thought that one
had to invoke the linker separately. Now I know how to do it in
one pass. However, I asked the question in the forum because it
did not seem to work. After some more experimenting with recursive
functions I came to the following conclusion:

1) The minimum stack size is 4*64KB=262144 bytes. Setting a
smaller value via -L/STACK has no effect.
2) The stack size is increased in 64KB chunks. If you specify a
number of bytes which is not a multiple of 64KB you will get the
size of the stack being the smallest multiple of 64KB bigger than
the number you specify. Thus if you have a stack overflow in your
program and increase the stack size by 10000 bytes for example,
you may see no effect.


More information about the Digitalmars-d mailing list