How to determine Hotspot VM default thread stack size

If I run java from the command line on my windows box like this:

"C:Program Files (x86)Javajdk1.7.0_51binjava.exe" -XshowSettings:all -Xss=1m -Xmx256m

I see this output:

VM settings:
Stack Size: 1.00M
Max. Heap Size: 256.00M
Ergonomics Machine Class: client
Using VM: Java HotSpot(TM) Client VM

The important part for me is "Stack Size: 1.00M", which is what I set it to be via the command line option "-Xss1m". But if I remove this option and let the VM run with the default stack size I get this output:

VM settings:
Max. Heap Size: 256.00M
Ergonomics Machine Class: client
Using VM: Java HotSpot(TM) Client VM

Notice it no longer displays the "Stack Size" anymore. I was hoping I would see the default size if I didn't specify a custom "-Xss" value. Is there any way to determine the default thread stack size?


The default stack size of Windows application is specified in .exe file header.
You can find it out using Cygwin objdump tool or with Microsoft Visual Studio dumpbin utility:

C:Program FilesJavajdk1.7.0_51bin> objdump -p java.exe | grep Stack
SizeOfStackReserve      0000000000100000
SizeOfStackCommit       0000000000001000

C:Program FilesJavajdk1.7.0_51bin> dumpbin.exe /headers java.exe | grep stack
      100000 size of stack reserve
        1000 size of stack commit

As we can see, Java 7 x64 default stack size in 0x100000 (1 MB).
For x86 version, the default stack size is 0x50000 (320 KB):

C:Program Files (x86)Javajre7bin>objdump -p java.exe | grep Stack
SizeOfStackReserve      00050000
SizeOfStackCommit       00001000
链接地址: http://www.djcxy.com/p/82750.html

上一篇: 使用Swing和AWT的Java内存监视器

下一篇: 如何确定Hotspot VM的默认线程堆栈大小