Should the Xss parameter for the JVM be used only for Java Stacks or also for Native Stacks?

I know that some kind of virtual machine, like JMM Harmony, puts the Java Stack and Native Stack on the same stack and spins the stack using the M2N Frame for each thread.

Some other JVMs seem to put them separately. My question is, does the Xss option for the JVM, which sets the maximum JVM stack size, cover the total size of Java stacks, or also include the size of its own stacks?

+7
java jvm
source share
1 answer

I do not have a definitive answer to this question, but when you look at some of the released documents when hotspot became vm by default, you can see this , which states that:

HotSpot does not have separate native and Java stacks

Other anonymous evidence can be found in this blog post about setting stack size:

Note that it is entirely possible that your OS will round off the values ​​for the stack size indicated by your -Xss parameter. Watch for this.

So it looks like the access point has one stack for a thread, which is actually a native, os-provided stack (hence rounding).

There is some more evidence here :

In the HotSpot implementation, Java methods share stack frames with native C / C ++ code, namely native user code and the virtual machine itself

and finally, in the openjdk source code :

// HotSpot does not have separate native and Java stacks

+6
source share

All Articles