I am running into OutOfMemoryError, how can I add more memory?


You can add more memory via Glassfish commands: 

  • Change to the user running Glassfish, and go to glassfish/bin directory. 
  • run ./asadmin list-jvm-options to list jvm options
  • Find how much memory is currently assigned to your jvm heap. The line looks something like -Xmx1024m
  • Delete the setting by running ./asadmin delete-jvm-options '-Xmx1024m' (or whatever your setting looks like)
  • Add more memory, preferably just double the old amount. Make sure your environment actually has enough memory.
    • ./asadmin create-jvm-options '-Xmx4096m'
  • Restart glassfish
    •  ./asadmin stop-domain domain1
       ./asadmin start-domain domain1