Reputation: 14271
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?
Upvotes: 7
Views: 343
Reputation: 24192
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
Upvotes: 6