stack size

S

Simon Richard Clarkstone

john said:
With gcc how do I increase the space available for the stack ?
This is a question about a specific implementation, not the C language.
I recommend consulting your compiler docmentation. You should be able
to type "info gcc" to get to it. I am pretty sure that there is an
option for this.
 
R

Richard Tobin

john blackburn said:
With gcc how do I increase the space available for the stack ?

This is probably an operating system limit, not a compiler one.
If you're using unix, look at the "limit" or "ulimit" command.

-- Richard
 
M

Malcolm

john blackburn said:
With gcc how do I increase the space available for the stack ?
I don't know and it might not even be possible.
Why are you gobbling up the stack so greedily? As a general rule, nothing
bigger than 1K should go on the stack (use malloc() instead). Also, the code
should be a roughly balanced tree of calls, so even a huge program won't be
many routines deep. This leaves recursive functions. Do you need to pass
every parameter to a recursive function, or can some be turned into globals?
As a last resort, rewrite the code to eliminate the recursion.
 
M

Martin Ambuhl

john said:
With gcc how do I increase the space available for the stack ?


Post gcc questions to a gnu.* newsgroup or to a newsgroup or mailing
list for your particular implementation.
 
R

Richard Tobin

Malcolm said:
As a general rule, nothing
bigger than 1K should go on the stack (use malloc() instead).

Why?

You might as well say everything with stack scope should go on the
stack.

*If* you expect your program to be used in environments where the
stack is small, don't put much on the stack. But the same applies to
all limited resources.

-- Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top