Stack size
Bryce McKinlay
bryce@waitaki.otago.ac.nz
Fri Dec 7 13:58:00 GMT 2001
Steen Jansdal wrote:
>Newbie question:
>>What is the stack size for each thread?
>
It depends on the platform. On linux, it depends on the kernel and glibc
version. Its more appropriate to talk about stack size limits since the
stack will automatically grow as needed up to a certain limit. On
PowerPC, the stacks seem to be allocated at fixed addresses 2MB apart so
the limit is therefore 2MB. On x86, the newwer glibc's use the kernel's
"floating stack" feature and the size limit is more like 32MB or 64MB I
think.
>Is it possible to change the stack size on
>a per-thread basis?
>
The pthread API does have a pthread_attr_setstacksize() which allows you
to set a minimum stack size. I suspect it doesn't do much to call this
on linux. Why do you want to explicitly set the stack size?
regards
Bryce.
More information about the Java
mailing list