powered by Jive Software

What happens when out of java memory

I currently have my java memory on openfire set to 256M and as we add more people it obviously uses more memory. It hasn’t got over 200M yet but I would like to know what happens when it tries to use more then 256M of memory, will the jvm crap out on me or will it consume more memory as it needs?

I have 2G of memory on the server so should probably bump it up to 1G anyway but I was just curious.


Hey Jason,

When the JVM is getting close to the max heap size it will try to remove unused objects from memory in a more aggressive way. If that operation released enough memory then the JVM will continue working fine. However, if not enough memory was released then the JVM will eventually run out of memory and will crash. You are start seeing OutOfMemory exceptions in the log files when that is the case.

How many concurrent users are logged in the server? How big are their rosters and avatars? If you don’t see any problem in the log files that you are running out of memory then you might be fine with 256MB. 512MB is usually a common setup too.


– Gato


even when you reach 256 MB there is no problem as the JVM usually allocates 30% more than it needs to have 30% free.

If your server is now running stable with 200 MB you could set Xmx to 180 MB and it should still work fine without OutOfMemory errors. If the server has not enough memory one will do this, but as you have enough memory you can keep Xmx256 as long as it is not reached.