From the documentation, -Xss is used to set the size of the JVM stack. But I am very confused by this expression.
In Java, each thread has its own stack. The number specified in -Xss:
Shared memory that can be used as a stack for all threads? for example, if -Xss is set to 256K, all threads will create their own stack in this 256K memory.
The size of each stack of thread. for example, if -Xss is set to 256K, each thread will have a 256K stack. Therefore, 10 threads will use a total of 2560K.
Thank you very much.
EDIT:
Thank you for your responses. It looks like this is (2) senario above. -Xss indicates the largest stack size for a particular thread.
Then I have the following question: where will this memory be allocated?
We can specify the reserved heap memory using -Xmx and -Xms. Will a stack be allocated using this reserved memory? Or is it directly allocated from its own memory?
Kevin source share