tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aparna Ramakrishnan <>
Subject OutOfMemoryError - how to increase heap size
Date Mon, 30 Jan 2006 15:14:44 GMT
I use a Asterisk-JAVA API program which on a random basis, calls a Servlet, using Tomcat5,
in order to set forwarding of calls through an Asterisk PBX Server. Two threads run throughout
the program, where one is an endless thread. I use JDBC onnection with MySql.
An hour after the program has been run, it gives an OutOfMemoryError - and hence the servlet
is not called and hence CallForwarding is not set. But again randomly, it works but at other
times sends an OutOfMemoryError. 

  On the start of the program, I check the 

Runtime.getRuntime().totalMemory() --> arnd 1.9 MB
Runtime.getRuntime().maxMemory() --> arnd 64 MB
Runtime.getRuntime().freeMemory() --> arnd 1.4MB

After the totalMemory reaches 64 MB, and freeMemory is less than 34556 bytes, the java.lang.OutOfMemoryError
is thrown. 
Since I am completely new to both JAVA and tomcat, I would like to know how I need to proceed.
I believe I must increase the maxMemory -- but how and where? 

  I start Tomcat5 using /etc/init.d/tomcat5 start . 
I run the JAVA program using Netbeans IDE 4.1 and not via command line.
  I read somewhere that the option -Xms128m -Xmx256m should be set for JAVA_OPTS environment
variable in the startup script used to starting tomcat. But I dont seem to understand where
I can add this value in /etc/init.d/tomcat5 file.

Kindly guide me further. Any help appreciated.
Thanks in advance

Do you Yahoo!?
 With a free 1 GB, there's more in store with Yahoo! Mail.
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message