wood burning stoves 2.0
The moose likes Tomcat and the fly likes Out of Memory Issues with Tomcat on Ubuntu 10 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Out of Memory Issues with Tomcat on Ubuntu 10" Watch "Out of Memory Issues with Tomcat on Ubuntu 10" New topic

Out of Memory Issues with Tomcat on Ubuntu 10

Kris van der Starren

Joined: Oct 25, 2010
Posts: 6
Hi There,

I have a web application running on Ubuntu 10 x64 and I keep receiving out of memory errors. The installation guide for the application indicates that the following line should be place in /etc/default/tomcat6

JAVA_OPTS="-Djava.awt.headless=true -Xmx1024m -Xms1024m -XX:MaxPermSize=512m -server"

I have 1.5 GB of RAM on the machine but whenever I try to add that line, tomcat refuses to start with an error of:
# A fatal error has been detected by the Java Runtime Environment:
# java.lang.OutOfMemoryError: requested 787536 bytes for Chunk::new. Out of swap space?

The closest I can get is the following:
JAVA_OPTS="-Djava.awt.headless=true -Xmx512m -Xms512m -XX:MaxPermSize=256m -server"

Even trying to move to 768MB with the following line fails:
JAVA_OPTS="-Djava.awt.headless=true -Xmx768m -Xms768m -XX:MaxPermSize=512m -server"

I'm a little confused as to why as there is 1.4 GB (1467008 B) of RAM free before starting Tomcat according to free:
root@193948:~# free
total used free shared buffers cached
Mem: 1573600 106592 1467008 0 0 0
-/+ buffers/cache: 106592 1467008
Swap: 0 0 0

Can anyone provide me with some pointers on how best to proceed?

Cheers, Kris
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

When a JVM crashes, the first thing you should generally do is try a different JVM. Probably 90% of the time, the bug will go away. It will probably be replaced by other bugs, but as long as they're not bugs that bite YOU, that's good enough.

It's possible that you don't have enough memory available in the OS, though. The JVM memory settings apply only to the JVM itself, and the JVM has to fit within the memory constraints of the OS. Especially if you have swapping turned off this can sometimes be a problem.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link: http://aspose.com/file-tools
subject: Out of Memory Issues with Tomcat on Ubuntu 10
It's not a secret anymore!