3

I face a very annoyed exception in glassfish which is

SEVERE: Exception in thread "RMI RenewClean-[192.168.1.2:8686]" 
SEVERE: PermGen space
java.lang.OutOfMemoryError: PermGen space

my hardware resources r high, and when I open task manager and notice the resources, it's available, this exception force me to restart my pc every 10 to 15 minutes :( what should I do?

palAlaa
  • 9,500
  • 33
  • 107
  • 166

2 Answers2

3

You need to increase the amount of PermGen space using the -XX:MaxPermSize=256m flag. See this related SO question

In order to set this up in Glassfish, use the following steps:

  • Connect to the admin interface of your Glassfish server (localhost:4848)
  • Move to Application Server > JVM Setting > JVM Options and check the global amount of memory allocated to your instance of Glassfish (should be something like -Xmx512m or more) and add one JVM Option with value:

-XX:MaxPermSize=256m

The amount of memory depends on the amount you need. Increase it if it keeps crashing, but reading the PermGen article may help in determining the right amount.

Community
  • 1
  • 1
amccormack
  • 13,207
  • 10
  • 38
  • 61
  • many thanx but where is this flag exist? I really confused. I tried to run it in cmd when I am inside the bin folder, but it was not a successful try! – palAlaa May 01 '11 at 18:59
  • I'm not sure if this is up to date, but check out this configuration guide: http://spaquet.blogspot.com/2006/07/liferay-glassfish-part-ii-configuring.html – amccormack May 01 '11 at 19:11
2

The permgem space is one of the most irritating errors in glassfish.

The permgem space is an error that appears when you use a lot of deploys or redeploys in the server, because the server reserves memory and never frees it. I recommend you to supervise the server with Apache JMeter to see the amount of memory (and if it is near the max, restart it before it crash).

To temporary fix it, you must include some variables in the server to improve his memmory consumption in the glassfish administrator like said amccormack.

I recommend you to use

-XX:PermSize=512m

-XX:MaxPermSize=512m

-XX:+CMSClassUnloadingEnabled

By the way, if the permgem space error appears, the server will not respond (even to asadmin stop-domain) . But you can easily restart if you kill the java process that runs glassfish and call asadmin start-domain. I think that it is quicker than restart all the server.

Community
  • 1
  • 1
  • Note that `CMSClassUnloadingEnabled` will only work with `UseConcMarkSweepGC`. The latter also means that `UseParallelGC` cannot be used. See http://stackoverflow.com/a/3334954/157762. – Daniel Szalay Dec 12 '13 at 16:30