tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Kientzle <kient...@acm.org>
Subject Re: out of memory error
Date Tue, 25 Jul 2000 20:35:47 GMT
Out of memory errors are not really all that uncommon
in Java, especially when you're working with
long-lived programs such as servlets.

Try adding something like this to your Java code:

Runtime rt = Runtime.getRuntime();
System.err.println("Heap size: "+(rt.totalMemory()-rt.freeMemory()));

This will print out the current size of the Java heap, and
give you some insight into how much memory you're really using.

Also, the Sun JVMs have a fixed maximum heap size, which defaults
to something like 16M, I think.  You might have to reconfigure
Tomcat to run java with the option:  -Xmx128m 
This will set the maximum Java heap size to 128 megabytes.

				- Tim



Lucas Ludvig wrote:
> 
> Hello!
> 
> I am getting out of memory errors.  Anyone else having this problem when the
> vm should still have lots of memory available?  Any other insights?
> Thanks.
> 
> Luke Ludwig
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

Mime
View raw message