title: How to set JVM to have more 1GB stack size?
body: <p>My OS info is as below:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>My JDK info is:</p>
  
  <pre><code>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)
  </code></pre>
  
  <p>But if I use more than 1GB stack, </p>
  
  <pre><code> java -Xss2g -Xmx100g Test
  </code></pre>
  
  <p>I got this:</p>
  
  <pre><code>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.&lt;clinit&gt;(Reference.java:162)
  </code></pre>
  
  <p>So, how could I use more than 1GB stack?</p>
  
  <p>Use "ulimit -a" I got this:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>From this, it seems the stack size limit is just 8MB. But it succeeded with 1GB.</p>