简体   繁体   中英

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:

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,

 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?

Use "ulimit -a" I got this:

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. But it succeeded with 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. Why are you using such enormous numbers?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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