Need help understanding OutOfMemory

Discussions

General J2EE: Need help understanding OutOfMemory

  1. Need help understanding OutOfMemory (1 messages)

    Hello. We are facing an OOM in production, that shows intermittently, with any load and in any function of the application. I know that sounds not new to all. Anyway, We need advice on how to solve the problem. So, here is a list of questions. 1. Using a HeapDump and several analysis tools, we were not able to find any memory leak. We have enough memory and a -Xms512m -Xmx784m setting. Nevertheless, the dump file is just 115mb or less. Can we compare that? Is that size a clue we can use to determine the problem is somewhere else and not actually that the memory is being totally consumed? 2. Now, if the above holds true, and there is actually memory unused (wonder how can we totally be sure of that), how come the JVM throws the exception? 3. I read something about the different memory "sections" to hold object of different ages (GC generational model). Is if possible some of those sections are not growing although there is memory to use? How can we fine tune those settings, if there are settings for that? 4. Further more, we are working in this config: Jboss 4.0.1sp1 JVM 1.4.2_12 Operating System W2K3 SP2 Could it be and older JMV-New O.S conflict problem? The actual error is: Unexpected Error; nested exception is: java.lang.OutOfMemoryError java.rmi.ServerError: Unexpected Error; nested exception is: java.lang.OutOfMemoryError 5. Unexpected Errors. Should this mean an error captured at JVM? That is, the exception is not caught during normal execution like creating an object or going through a loop. Our guess it is thrown when actually executing the GC. How can we sure of that? If that is correct, does it mean is it a JVM problem? Thanks for your help. William.
  2. You are correct. JVM has three generations across which the memory is distributed - Young, old/tenured and Permanenent generation. Heap settings -Xms512m -Xmx784m set the sizes for young and old generations whereas the permanent generation can be set using the following parameters -XX:PermSize -XX:MaxPermSize. By default -XX:PermSize=4m -XX:MaxPermSize=64m. For many applications these default parameters will not be sufficient. OOM exception is thrown for various reasons. It could be because of no sufficient memory on the machine, improper heap & java settings or memory leaks etc. To identify the root cause of OOM please enable the verbose:gc and start your JVM using these additional parameters -XX:+PrintGCTimeStamps -XX:+PrintHeapAtGC. These parameters will give dump enough information of memory consuption in various generations in nativestdout.log that will help you in debugging the OOM exception. More help on this can found in the below article http://java.sun.com/docs/hotspot/gc1.4.2/ Please send the GC log file if you need any further assistance ~ Thirumal