Setting thread stack size if using many threads

As mentioned in the section on ICS threading, Java threads consume memory in the heap. In addition, the threads themselves use virtual memory for their thread stacks. If a configuration is using an excessive number of threads, memory in either place may become a problem. The JVM allows a user to configure the amount of virtual memory set aside for the thread stack. The default thread stack size is different depending on the JVM version and the operating system. However, the mechanism to set the value is the same. To set the thread stack size to 128KB, the parameter -ss128k is passed in on the invocation of the JVM. Care should be taken not to set this value to small. It is recommend that at least 128KB be given to each thread stack, although the system may operate successfully with a lower setting.

Copyright IBM Corp. 1997, 2004