From the documentation, -Xss is used to set the stack size of JVM. But I am very confused about this statement.
In Java, every thread has its own stack. Does the number specified by -Xss:
The total memory that can be used as stack by all threads? e.g. If -Xss is set to 256K, all the threads will create their own stack within this 256K of memory.
The size of each stack of a thread. e.g. If -Xss is set to 256K, each thread will have a stack of 256K big. Hence 10 thread will use 2560K altogether.
Thank you very much.
EDIT:
Thanks for your answers. It looks like it is the (2) senario above. -Xss specifies the largest stack size of a particular thread.
Then I have a follow up question: Where will these memory be allocated on?
We can specify the reserved heap memory using -Xmx and -Xms. Will stack be allocated using these reserved memory? Or it is allocated from the native memory directly?