user146960
user146960

Reputation:

Increase stack size for a program to run

I'm looking for a way to increase the stack size, for my program to run, the reason is that I've a recursive call causing a stack overflow. Is there anyway I can change the default stack size?

Upvotes: 1

Views: 3604

Answers (3)

shivakumar
shivakumar

Reputation: 3397

Its compiler dependent. In Visual studio stacksize is fixed to 1 MB. You can increase it using /STACK linker option.

Upvotes: 0

jman
jman

Reputation: 11606

If its a *NIX, use

ulimit -s <number_in_kb>

You'd set that in your environment before running your program. You can also set it programatically as described in this answer.

You can view the current value by running ulimit -a.

Upvotes: 2

user2256107
user2256107

Reputation:

Use editbin to change the stack size of the program:

EDITBIN.EXE /STACK: yourprogram.exe

Upvotes: 1

Related Questions