You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ben Laurie <be...@algroup.co.uk> on 1999/10/20 10:20:22 UTC

Stack usage

Some threading implementations (e.g. Linux) grow the stack as needed.
Some (e.g. FreeBSD and Solaris) require it to be preallocated.

Anyone know of any good tools/trivial hacks for measuring stack usage?

Cheers,

Ben.

--
http://www.apache-ssl.org/ben.html

"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
     - Indira Gandhi

Re: Stack usage

Posted by Dean Gaudet <dg...@arctic.org>.

On Wed, 20 Oct 1999, Ben Laurie wrote:

> Anyone know of any good tools/trivial hacks for measuring stack usage?

at startup, call a function which allocates a 128kb array on the stack and
then writes some pattern to it... say 0xDEADBEEF.  Then periodically (set
a vtimer interrupt maybe and catch SIGVTALRM) call a function which also
allocates a 128Kb array on the stack and figure out where the pattern
lies... should be pretty easy to figure out how much stack has been used.

er, you probably want to use alloca() to allocate those arrays so that you
can ensure they're allocated below any frame the compiler wants to create.

Dean