where to find default XSS value for Sun/Oracle JVM

2019-01-07 06:05发布

问题:

Has anyone ever found a single JVM document listing default XSS sizes for various versions of the Sun/Oracle JVM, and for different OS's?

I've been able to find this table in the jrockit jdk 5.0 docs, but that's not helpful for those using the "normal" Sun/Oracle JVM.

I do appreciate that the XSS value will vary per OS (and JVM version), so maybe there is no one document that lists all recent combinations. But if any readers here know of any individual documents that list at least just the default XSS value for each JVM version (or at least 1.6 and 1.5), or even if only for some OS's, that would be a great start.

I'll add that the reason this is valuable is that often we see people recommend (wrongly, I think) that someone can solve a problem by changing the XSS value. But if you don't know your default, then there's no way to know if you're raising or lowering the value by whatever change someone recommends. They don't generally indicate the version/OS they're on, so it's a crapshoot whether their suggestion will "help" you.

Even better than some documentation, if anyone knows a way to query the JVM to get the current value, whether from the command line or via an API call, that would be even more valuable. Thanks.

回答1:

try:

java -XX:+PrintFlagsFinal -version | grep ThreadStackSize


回答2:

This information now appears in the Oracle Hotspot FAQ http://www.oracle.com/technetwork/java/hotspotfaq-138619.html#threads_oom

You may be running into a problem with the default stack size for threads. In Java SE 6, the default on Sparc is 512k in the 32-bit VM, and 1024k in the 64-bit VM. On x86 Solaris/Linux it is 320k in the 32-bit VM and 1024k in the 64-bit VM.

On Windows, the default thread stack size is read from the binary (java.exe). As of Java SE 6, this value is 320k in the 32-bit VM and 1024k in the 64-bit VM.

You can reduce your stack size by running with the -Xss option. For example:

java -server -Xss64k

Note that on some versions of Windows, the OS may round up thread stack sizes using very coarse granularity. If the requested size is less than the default size by 1K or more, the stack size is rounded up to the default; otherwise, the stack size is rounded up to a multiple of 1 MB.

64k is the least amount of stack space allowed per thread.



回答3:

You can find it at Oracle site under "-XX:ThreadStackSize" option which means the same as -Xss.



回答4:

For hotspot it depends on your architecture and what not.

The default stack size can be found in the source code in the header files that relate to a given platform e.g.

google code search (edit: this service has been deactivated since this answer was made, sadly) UPDATE: here's a new link from Nebelmann: Openjdk source: globals_windows_x86.hpp

Not sure if this helps but its a start



回答5:

There are default settings available from IBM Java 6 user guide (source):

Xss <size> for Java Threads 32 bits:

AIX®: 256KB
IBM®I: 256KB
Linux: 256KB
Windows: 256KB
z/OS®: 256KB