I know some Virtual Machine like Harmony JVM put Java Stack and Native Stack into one stack and perform stack unwinding using a M2N Frame for each thread.
Some other JVMs seem to put them separately. My question is do the Xss option to JVM that set the maximum stack size of JVM cover the total size of the Java stacks or also including the size of native stacks?
Sets the maximum stack size for Java™ threads. To increase the maximum number of threads your system can support, reduce the maximum native stack size. The default is 320 KB for 31-bit or 32-bit VMs and 1024 KB for 64-bit VMs.
JVM Options Overview There are three types of options that you can add to your JVM, standard, non-standard and advanced options. If you apply an advanced option, you always precede the option with -XX: . Similarly if you're using a non-standard option, you'll use -X .
The default value for the stack size in the JVM is 1024K. Therefore, you must increase the stack size for the JVM to 4M depending on the recursive logic defined in the workflow.
The Java Stack class provides mainly five methods to perform these operations. Along with this, it also provides all the methods of the Java Vector class.
I do not have a definitive answer to this but when you look at some of the documents released when hotspot became the default vm, you can see this, which states that:
HotSpot doesn't have separate native and Java stacks
Another anecdotal evidence could be found in this blog post that deals with stack size tuning:
Note that it is entirely possible that your OS rounds up values for stack size specified by your -Xss parameter. Watch out for that.
So it appears that hotspot has a single stack per thread that is actually the native, os-provided stack (hence the rounding).
There's some more evidence here:
In the HotSpot implementation, Java methods share stack frames with C/C++ native code, namely user native code and the virtual machine itself
and finally, in openjdk source code:
// HotSpot does not have separate native and Java stacks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With