Today, I have just known that there's an another interesting parameter to set to JVM. It is java thread stack size.
With too high thread stack size, it will effect to low number of thread JVM can create -
see this experiment. Not enough memory for java thread (cause from too big stack size) will produce
"java.lang.OutOfMemoryError: unable to create new native thread"You can set java stack thread size by adding
-XssnK to JVM argument where n stands for a wanted size.
Now, I am not sure what is the default java thread stack size. Someone tells it is 512Kb. Another one tells it is up to the platform. One thing is that it's vary between each java versions. However, there is a way to get it from your running JVM. I got this trick from
Get thread stack size at runtime thanks to claudio. Note that this trick may work only with *nix family.
First, you have to know your target JVM's pid (process id). If your system has only one JVM running, it is easy to use 'ps' or top to find it. But if it has many, my often used approach is to use
jps -lv
and justify it from the informations provided. If the informations are equally the same, help yourself :P.
Now you have target JVM's pid.
Then run following command
jinfo -flag ThreadStackSize {PID}
The jvm's set thread stack size will show to you in Kb.