[jboss-user] [Installation, Configuration & DEPLOYMENT] - Re: Problem with java.lang.OutOfMemoryError

thetikigod do-not-reply at jboss.com
Thu Sep 25 15:07:12 EDT 2008


Periodically when developing and redeploying web apps, an error will occur and the JBoss AS will crash, burn, and will require a restart. Most of the time, the error is an out of memory error and will appear in the console as follows:


  | 10:10:22,640 ERROR [MainDeployer] Could not create deployment: file:(yourFile)
  | java.lang.OutOfMemoryError: PermGen space
  | 

To fix this you will need to modify the run file, again. There are two options: increase the size of the PermGen or allow garbage collection on PermGen . Each method has its pro/cons. Increasing the size of the PermGen will only delay the errors longer, because the memory will be used up eventually. If all you are looking to do is increase the time between restarts, this is a viable solution. If low memory is an issue or if the error must be prevented altogether, then garbage collection should be permitted on PermGen. With this solution, you may run the risk of garbage collecting classes that will be used again (this has not been tested). Both may be used which may lessen the risk that classes will be collected before their time. Realize that this does not eliminate the risk. Note that both methods will require JBoss AS to be restarted.

Increase Memory Size of PermGen:

   1. Navigate to JBOSS_HOME/bin/.
   2. Open the run.conf (run.bat for windows) file for editing.
   3. Add the following after the remote debugging lines:

      In run.conf:

  |       # Memory configuration to delay PermGen: OutOfMemoryError(s)
  |       JAVA_OPTS="$JAVA_OPTS -XX:MaxPermSize=512m"
  | 
      In run.bat:

  |       rem Memory configuration to delay PermGen: OutOfMemoryError(s)
  |       set JAVA_OPTS=-XX:MaxPermSize=512m %JAVA_OPTS%
  | 
   4. Save the file.
   5. PermGen will be configured with a larger memory space. 

*Note: A size other than 512 may be used.




Garbage Collection on PermGen

   1. Navigate to JBOSS_HOME/bin/.
   2. Open the run.conf (run.bat for windows) file for editing.
   3. Add the following after the remote debugging lines:

      In run.conf:

  |       # Garbage Collection configuration to fix PermGen: OutOfMemoryError(s)
  |       JAVA_OPTS="$JAVA_OPTS -XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled"
  | 
      In run.bat:

  |       rem Garbage Collection configuration to fix PermGen: OutOfMemoryError(s)
  |       set JAVA_OPTS= -XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled %JAVA_OPTS%
  | 
   4. Save the file.
   5. PermGen will be configured to be garbage collected.

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

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



More information about the jboss-user mailing list