How to get current stack size ?

Fergus Henderson fjh@cs.mu.OZ.AU
Thu Feb 20 08:59:00 GMT 2003


On 20-Feb-2003, Igor Bukanov <igor@icesoft.no> wrote:
> Is there any internal function in GCC that I can use to determine 
> currently consumed stack space? Or I should better ask glibc guys about it?

This sounds more like a glibc issue.  Try getrusage() -- the "ru_isrss"
member of "struct rusage" reports "integral unshared stack size",
which sounds like it should do what you want (although I have not tested it).

Alternatively, look at the code for GC_get_stack_base() in the Boehm
conservative collector (which is included in the GCC sources).

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.



More information about the Gcc mailing list