安卓java vm堆栈大小,如何确定Hotspot VM默认线程堆栈大小

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

"C:\Program Files (x86)\Java\jdk1.7.0_51\bin\java.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 Files\Java\jdk1.7.0_51\bin> objdump -p java.exe | grep Stack

SizeOfStackReserve 0000000000100000

SizeOfStackCommit 0000000000001000

C:\Program Files\Java\jdk1.7.0_51\bin> 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)\Java\jre7\bin>objdump -p java.exe | grep Stack

SizeOfStackReserve 00050000

SizeOfStackCommit 00001000

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值