[dtrace-discuss] Detect stack size
Casper.Dik at Sun.COM
Casper.Dik at Sun.COM
Tue Dec 5 00:08:52 PST 2006
>Casper.Dik at Sun.COM wrote:
>>> why not? as far as I understand, getrlimit and setrlimit are in standard
>>> C lib as welland they have been used to dynamically get the soft an hard
>>> limit of the resources in the context of the current process.
>>>
>>
>> Yes, but they don't work for the stack size parameters.
>>
>they work for stack size as well as cpu time,maximum file size, data
>size, core file size etc.
>are all resources that are allowed to be tuned in the given process's
>context.
>I recall only use of RLIMIT_STACK resource so far.
Perhaps you should read the manual page:
RLIMIT_STACK The maximum size of a process's stack in
bytes. The system will not automatically
grow the stack beyond this limit.
Within a process, setrlimit() will increase
the limit on the size of your stack, but
will not move current memory segments to
allow for that growth. To guarantee that the
process stack can grow to the limit, the
limit must be altered prior to the execution
of the process in which the new stack size
is to be used.
Within a multithreaded process, setrlimit()
has no impact on the stack size limit for
the calling thread if the calling thread is
not the main thread. A call to setrlimit()
for RLIMIT_STACK impacts only the main
thread's stack, and should be made only from
the main thread, if at all.
In short: no effect and thread stacks and little or no effect
on the stack of the currently executing process (see the second
hald of the second paragraph.
Casper
More information about the dtrace-discuss
mailing list