Maximum process stack size

Guy Harris guy at auspex.auspex.com
Fri Aug 10 07:26:23 AEST 1990


>Is there a way for a program to determine the maximum stack size of a
>process on systems that don't support getrlimit(RLIMIT_STACK), such
>as POSIX-, SVID-, or X/Open-systems?

Not all POSIX-compliant, SVID-compliant, or X/Open-compliant systems
lack "getrlimit()"; in fact, SVID Third Edition-compliant systems *have*
to support "getrlimit(RLIMIT_STACK)" (as well as RLIMIT_CORE,
RLIMIT_CPU, RLIMIT_DATA, RLIMIT_FSIZE, RLIMIT_NOFILE, and RLIMIT_AS).

Neither POSIX, nor X/Open, nor SVIDs prior to the third edition specify
any say of finding this information out, so if you're trying to write
something that will work on *any* POSIX-compliant or *any*
X/Open-compliant or *any* SVID-compliant system, you're out of luck.

>If you don't know the general answer-- do you know if and how this can
>be done under HP-UX?

HP-UX does support "getrlimit()"?  If there were such a mechanism, and
they didn't stuff it into "ulimit()", I'd expect HP to stuff it there. 
If it's not there, you may be out of luck.

>If this functionality doesn't exist, does this mean the stack of a process
>can grow indefinitely?

Err, no, you eventually run out of address space....  What other
policies a particular UNIX implementation puts on the stack depend on
the implementation, so there really aren't any hard-and-fast
guarantees.



More information about the Comp.unix.questions mailing list