How to increase stack memory?
Duplicate How to allow more memory and avoid recursion?
I am writing a branch and related algorithm that has at least 10,000 levels of recursive function, but it does not work due to a bug. here is a simple example of my program in C ++:
void f(int k)
{
if(k==10000) return;
f(k+1);
}
void main()
{
f(1);
return;
}
can anyone help?
0
Abbas
a source
to share
6 answers
This is a linker problem. You will need to tell the linker to increase the amount of memory allocated for the stack. It is different for different languages ββand compilers. It can be a command line parameter, or it can be a configuration file, or it can even be specified in the source code.
+4
a source to share