Java Reference
In-Depth Information
Table 9-9. Default stack size for various JVMs
Operating system 32-bit
320 KB 1 MB
Mac OS
1 MB
Solaris Sparc
512 KB 1 MB
Solaris X86
320 KB 1 MB
320 KB 1 MB
In a 64-bit JVM, there is usually no reason to set this value unless the machine is quite
strained for physical memory and the smaller stack size will prevent applications from run-
ning out of native memory. On the other hand, using a smaller (e.g., 128 KB) stack size on a
32-bit JVM is often a good idea, as it frees up memory in the process size and allows the
JVM to utilize a larger heap.
One time an OutOfMemoryError can occur is when there isn't enough native memory to create
the thread. This can indicate one of three things:
1. In a 32-bit JVM, the process is at its 4 GB (or less, depending on the OS) maximum size.
2. The system has actually run out of virtual memory.
3. On Unix-style systems, the user has already created (between all programs she is running)
the maximum number of processes configured for her login. Individual threads are con-
sidered a process in that regard.
Reducing the stack size can overcome the first two issues, but it will have no effect on the third.
Unfortunately, there is no way to tell from the JVM error which of these three cases applies, but
consider any of these causes when this error is encountered.
To change the stack size for a thread, use the -Xss= N flag (e.g., -Xss=256k ).
Search WWH ::

Custom Search