Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tomcat -> out of memory error

Status
Not open for further replies.

portagal

Programmer
Jul 28, 2004
32
CA
Hi,
I am admining an application running on tomcat 4.1.29/ windows 2000. Recently i am getting java.lang.outofmemory error every now and then. As I checked CATALINA_OPT and JAVA_OPT environment variables are set to following value:
"-Xms1024m -Xmx1024m -Xmn512m"
Quotations are part of the value.
Is this correct, i have seen some people suggesting to set it to "-server -Xms1024m -Xmx1024m -Xmn512m" or
"-client -server -Xms1024m -Xmx1024m -Xmn512m" with/without quotation, so my question is do i need to have both CATALINA_OPT and JAVA_OPT or one is enough? What is the correct value (with or without server/client)?
My next question is how can i check to see if the max size is actually set?

Many thanks in advance
Portagal
 
I just use :

-Xms512m -Xmx512m

(for half a gig).

To check the actual JVM size, either check your process memory on the OS, or in a JSP/servlet :

long totalMemoryAllocated = Runtime.getRuntime().totalMemory();

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Thanks for the reply.
I cannot get this working, i have tried different approaches (out of desperation): adding CATALINA_OPTS and/or JAVA_OPTS as my environment variable and i have tried the value with and without qoutation marks and i have tried to edit the catalina.bat file under tomcat/bin and adding this line
set JAVA_OPTS=-Xms512m -Xmx512m
i also tried this line
set JAVA_OPTS=-server -Xms512m -Xmx512m
Non of these seems to be able to set my JVM's heap size I have added
long totalMemoryAllocated = Runtime.getRuntime().totalMemory();
to my JSP file, and no matter how i attempt to set the heap size totalMemoryAllocated is always equal to 66650112 which i believe is the default size of the heap size.
Please help!!!
 
Ok, it worked after all.
it turns out if tomcat is started form the Start Menu under windows, setting CATALINA_OPTS/JAVA_OPTS has no effect and i have to start from tomcat-home>bin>startup.bat

Thanks,
Portgal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top