[jboss-user] [Performance Tuning] - Re: Out of memory errors

PeterJ do-not-reply at jboss.com
Wed May 6 11:33:36 EDT 2009


This error: "java.lang.OutOfMemoryError: unable to create new native thread" usually means that the operating system has run out of memory with which to allocate the necessary memory for a new thread. Assuming you are running a 32-bit OS or a 32-bit JVM, There are several possibilities for this.

One possibility is the OS has run out of room in its memory area (usually the upper 1GB or 2GB address space of the application). I have seen this happen is, of example, I boot Windows with the /3GB option - this options leaves only 1GB for Windows memory area which is often not sufficient to hold the handles that Windows uses to manage threads.

Another possibility is that there is insufficient memory in the app's memory area to allocate the memory required for the new thread. Depending on you OS, each thread could require 1MB or memory (and it looks like you have it set for 1MB). Considering that you are allocating a total of 1.5GB memory to the heap and permgen, that leaves not that much extra room for many threads.

So you have a few options:

a) Reduce the memory allocated to each thread. Try using -Xss768k or even -Xss512k. Usually the lowest possible value without getting a stack overflow is what you want.

b) Decrease the heap size. For example, given your current thread stack memory size, setting -Xmx=1200m would allow 80 more threads to be allocated.

c) Reduce the maximum number of threads that can be allocated. This involves both the worker threads declared in jboss-service.xml and the htttp (and related) threads declared in the server.xml file. Though this option is not always guaranteed to be effective because there are other locations where threads are created that are not governed by these limits. For example, I'm not sure where, or if, there is a limit on RMI threads, which I think is the type of thread that could not be created.

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4229082#4229082

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4229082



More information about the jboss-user mailing list