[Info-vax] POSIX Thread stack highwater mark

VAXman- at SendSpamHere.ORG VAXman- at SendSpamHere.ORG
Thu Feb 10 18:25:12 EST 2011


In article <2174b7d3-c50a-4062-85b4-212b6c8c0d97 at i39g2000prd.googlegroups.com>, RobertsonEricW <robertsonericw at netzero.net> writes:
>Is there a way to determine the highwater mark for usage of a POSIX
>Thread's stack?

Programatically?


>I am trying to determine the appropriate stack size based on empirical
>executions of a thread so that I don't waste memory by allocating an
>unnecessarily large stack when creating a POSIX thread.

What are you doing on its stack?


FWIW, the threadID is the address of the TEB (thread environment block).
If you're using POSIX/DECtrheads from C, #include <tebdef.h>.  This has
the structure definition of the TEB.  TEB$PQ_STACK_HIWATER should, if
the thread stack metering is enable, contain the highwater mark.

$ DEFINE PTHREAD_CONFIG "meter=(stack)"

Is supposed to enable this metering.  I'm not thoroughly convinced that
it does.  You could write the stack pointer for your thread to this at
various locations in the code if you're really not certain.


-- 
VAXman- A Bored Certified VMS Kernel Mode Hacker    VAXman(at)TMESIS(dot)ORG

All your spirit rack abuses, come to haunt you back by day.
All your Byzantine excuses, given time, given you away.



More information about the Info-vax mailing list