Friday, June 19, 2009

OutOfMemoryException: unable to create new native thread

This error will occur even when you have plenty of heap, but the OS cannot allocate more memory for the threadstack. You can reduce the size of the thread stack with -Xss128k. The total memory usage equation is:

(heap size) + (number of threads)x(thread stack size) = (total RAM used by JVM process).

Default Thread Size:
Thread Stack Size (in Kbytes). (0 means use default stack size) [Sparc: 512; Solaris x86: 320 (was 256 prior in 5.0 and earlier); Sparc 64 bit: 1024; Linux amd64: 1024 (was 0 in 5.0 and earlier); all others 0.]

Articles:
http://www.jboss.org/community/wiki/OutOfMemoryExceptions
http://www.jboss.org/community/wiki/OutOfMemoryExceptionWhenCannotCreateThread
http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp

No comments:

Post a Comment