简体   繁体   English

如何设置JVM具有更大的1GB堆栈大小?

[英]How to set JVM to have more 1GB stack size?

My OS info is as below: 我的操作系统信息如下:

Linux 3.1.10-1.16-default #1 SMP Wed Jun 27 05:21:40 UTC 2012 (d016078) x86_64 x86_64 x86_64 GNU/Linux

My JDK info is: 我的JDK信息是:

java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.3) (suse-6.2-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

But if I use more than 1GB stack, 但是如果我使用超过1GB的堆栈,

 java -Xss2g -Xmx100g Test

I got this: 我懂了:

Error occurred during initialization of VM
java.lang.OutOfMemoryError: unable to create new native thread
    at java.lang.Thread.start0(Native Method)
    at java.lang.Thread.start(Thread.java:657)
    at java.lang.ref.Reference.<clinit>(Reference.java:162)

So, how could I use more than 1GB stack? 那么,我如何使用超过1GB的堆栈?

Use "ulimit -a" I got this: 使用“ ulimit -a”我得到了:

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 1291902
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 1291902
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

From this, it seems the stack size limit is just 8MB. 由此看来,堆栈大小限制仅为8MB。 But it succeeded with 1GB. 但是它成功了1GB。

You don't need either a 2G stack or a 100G heap, and in any event your physical hardware is most unlikely to be able to supply them. 您不需要2G堆栈或100G堆,无论如何,您的物理硬件最不可能提供它们。 Why are you using such enormous numbers? 您为什么要使用如此庞大的数字?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM