• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Out of Memory Issues with Tomcat on Ubuntu 10

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Saloon Keeper
Posts: 24283
167
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic