Clear Java Memory

Hi Openfire team,

Is there anyway can we clear Java memory automatically by running any scripts or manually,because the server is crashing once the Java memory reaches max.

i am using Openfire 3.7.1 in ubuntu server with 8GB of RAM

and allocated 7GB to Java memory(i am using this openfire 250 users).

Please suggest me on this,Thanks in advance.

You can try clearing the caches in Cache Summary. Also you can create a system property xmpp.pep.enabled and set it to false (there is a leak in PEP module). But this doesn’t fix the problem completely. Usually i have to restart my server once in a while. Though it was running for years smoothly with the similar load. I suspect it may be some new Java bug (as i update Java on this system) in conjunction with Openfire memory leaks problems. I have around 200 users and i have only 350 MB set for JVM. As i stop the server for backup monthly it is enough for it to run without problems for 30 days. Of course, it depends on the usage, but i think in your case it is some memory leak, especially if PEP is not disabled. 7 GB for just 250 users is an overkill…

Sorry, no automatic scripts that i know of.

1 Like

You can force a GC to run by connecting to the JVM via JMX - Something like jvisualvm which ships with JDK has a ‘Force GC’ button.

That said, if you have a memory leak or something, it’s not going to help very much. Make sure you have PEP disabled and are running the most current 1.6 JRE.

Are you using Oracle JRE, or Openjdk (or whatever ships with Ubuntu?). If you are not using Oracle’s, you might want to try.

Thanks alot.Now it is working fine