Xss sets the thread stack size for 1 thread, which is the limit for all thread stack sizes

I know how to set the stack size for a java stream using -Xss, and we use it in our product.

But when there are many threads used in our application, and -Xss is installed (for our use we install 512k). we will encounter an error message that cannot create a new native thread. it should be related to the size of the stack, because when we install -Xss256k, the error has disappeared.

My question is for 1 thread, Xss set the stack size, but what about for all thread stack sizes?
What is the overall stack memory limit in general? I did not find such a JVM setup, while we are really facing such a problem now.

+4
source share
1 answer

-Xss sets the default virtual memory for each new thread stack. (That is, for each new thread that is not given an explicit stack size through its constructor.)

There is no way to limit the combined stack sizes for all threads.

If the -Xss down from 512K to -Xss allows your program to create more threads, then your program must create a lot of threads.

What are all these streams?

Are you sure you cannot solve the problem using a limited number of threads in the thread pool?

+4
source

All Articles