tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From o.@veon.com
Subject Re: Out of Memory Error - plz help
Date Tue, 04 Jun 2002 08:33:47 GMT

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
10MB.
-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 catalina.sh file is, usually this is the place to
update.

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
this:

try
{
     code...
}
catch (Exception e)
{
}
cacth (Error e)
{
}

Oz.


                                                                                         
                       
                    # Lalit Nagpal                                                       
                       
                    #                    To:     tomcat-user@jakarta.apache.org          
                       
                    <lalit_tomcat@       cc:                                          
                          
                    yahoo.com>           Subject:     Out of Memory Error - plz help  
                          
                                                                                         
                       
                    06/04/2002                                                           
                       
                    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

Regards


=====
# Lalit Nagpal #

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

--
To unsubscribe, e-mail:   <
mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <
mailto:tomcat-user-help@jakarta.apache.org>







--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message