Summary
The launcher should round up the stack size specified with the -Xss option to a multiple of the system page size as required by the operating system.
Problem
The Java launcher use pthread_attr_setstacksize
to set the stack size of the initial thread on POSIX systems. On some systems, like MacOS, the stack size is required to be a multiple of the system page size; otherwise, the call will fail and lead to use of the default stack size.
Solution
The launcher will try to set the stack size with the specified value. In case that fails, the launcher will round up the specified stack size to a multiple of the system page size and try again.
Specification
java -X says about -Xss option:
-Xss<size> set java thread stack size
will be changed to
-Xss<size> set java thread stack size
The actual size may be rounded up to a multiple of the system
page size as required by the operating system.
- csr of
-
JDK-8236569 -Xss not multiple of 4K does not work for the main thread on macOS
- Resolved