Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > stack size

Reply
Thread Tools

stack size

 
 
john blackburn
Guest
Posts: n/a
 
      10-24-2004
With gcc how do I increase the space available for the stack ?
 
Reply With Quote
 
 
 
 
Simon Richard Clarkstone
Guest
Posts: n/a
 
      10-24-2004
john blackburn wrote:
> 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.

--
Simon Richard Clarkstone
s.r.cl*rkst*n*@durham.ac.uk / s*m*n_cl*rkst*n*@hotmail.com
 
Reply With Quote
 
 
 
 
Richard Tobin
Guest
Posts: n/a
 
      10-24-2004
In article <417bc441$0$3035$(E-Mail Removed)>,
john blackburn <(E-Mail Removed)> wrote:

>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
 
Reply With Quote
 
Malcolm
Guest
Posts: n/a
 
      10-24-2004

"john blackburn" <(E-Mail Removed)> wrote
>
> 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.


 
Reply With Quote
 
Martin Ambuhl
Guest
Posts: n/a
 
      10-24-2004
john blackburn wrote:
> 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.
 
Reply With Quote
 
Richard Tobin
Guest
Posts: n/a
 
      10-24-2004
In article <clgpgq$riv$(E-Mail Removed)>,
Malcolm <(E-Mail Removed)> wrote:

>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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why does std::stack::pop() not throw an exception if the stack is empty? Debajit Adhikary C++ 36 02-10-2011 08:54 PM
C/C++ compilers have one stack for local variables and return addresses and then another stack for array allocations on the stack. Casey Hawthorne C Programming 3 11-01-2009 08:23 PM
stack frame size on linux/solaris of a running application stack Surinder Singh C Programming 1 12-20-2007 01:16 PM
Can we determine stack size & Heap size at runtime ? sunny C Programming 5 08-17-2006 12:17 AM
"stack level too deep"... because Threads keep their "starting" stack Sam Roberts Ruby 1 02-11-2005 04:25 AM



Advertisments