tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jack Li <>
Subject RE: Out of Memory Error - plz help
Date Tue, 04 Jun 2002 14:06:23 GMT
in setclasspath.bat file set JAVA_OPTS="-ms10M -mx512M"

Jack Li

-----Original Message-----
From: []
Sent: Tuesday, June 04, 2002 4:34 AM
To: Tomcat Users List
Subject: Re: Out of Memory Error - plz help

I'm not sure this answers your question, but hopefully:
1. I can't say what the cause for the out of memory error is, but if you
are writing in Java (JSP or servlet), you can try and check the memory
status on your computer. This is done by:

Runtime rt = Runtime.getRuntime();
long mem = rt.totalMemory();
long freemem = rt.freeMemory();

The first line gives you a runtime environment, the second one gives you
the amount of memory the JAVA Runtime Environment (JRE) currently
possesses, and the third line gives you the amount of available memory.
This should help you debug and find the mischievous code.

2. In order to launch the JRE with more memory, you can set the JAVA_OPTS
environment variable, which Catalina uses, in the following manner:
JAVA_OPTS="-ms10M -mx512M"

-ms sets the minimum amount of memory for the JRE, in this case it's set to
-mx sets the maximum amount of memory (I think the default is 64MB, which
should be quite a lot, I don't know why your program runs out of memory).

The place where you set the JAVA_OPTS depends on your platform and
installation. All I can tell you is that if you installed Tomcat with RPM
on linux, then you best add this line to the file
/etc/init.d/tomcat/tomcat4.conf . As for other installations, check to see
where the catalina.bat or file is, usually this is the place to

3. Finally (sorry for the lengthy answer), you can add a try catch around
your code. Be aware, however that your catch should catch "Error" since
OutOfMemoryError doesn't extend Exception, so you should do something like

catch (Exception e)
cacth (Error e)



                    # Lalit Nagpal

                    #                    To:                                  
                    <lalit_tomcat@       cc:

          >           Subject:     Out of Memory Error -
plz help                             


                    07:37 AM

                    Please respond

                    to "Tomcat

                    Users List"



hello friends,

I get this wierd error "Out of Memory --- No Stack
Trace". Actually i have a form that a student fills up
attaches his mark statement (scanned image) and
photograph. The form is received properly on the
server but then the server goes down any time - giving
the output as << Out of Memory Error - No Stack Trace
>> in catalina.out file. Any ideas, plz help


# Lalit Nagpal #

Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message