Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.


Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

tomcat -> out of memory error

tomcat -> out of memory error

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

RE: tomcat -> out of memory error

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

RE: tomcat -> out of memory error

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!!!

RE: tomcat -> out of memory error

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


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close