You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Patrick Codere <pa...@motovan.com> on 2002/08/27 00:15:07 UTC

OUT OF MEMORY ERROR

Hi everyone,

	I have been getting this error for the past few weeks without
solving the issue.  But I just found out that I had forgotten to close a
database connection.  Could that have been the problem?  Time will tell, but
what exactly happens when you don't close a db connection? 

Thanks for your help.

Pat

RE: OUT OF MEMORY ERROR

Posted by Mike Jackson <mj...@cdi-hq.com>.
If you don't close the connection you'll eventually run the database out
of connections.  Also an open connection will use memory within the JVM
and build up the memory in use.  Another thing to do is to avoid using
strings, use stringbuffers instead.  Try to avoid doing things like this:

	String str = "This " + number + " that " + anotherString;

If you do this you're creating a number of string objects, and the garbage
collector may not reclaim the memory quickly.  You can try adjusting the
memory that the JVM grabs at startup as well, the arguement is something
like -Xmx512M (that would grab 512 megs of ram).

One thing to consider, and it works great for me, is to use your servlets
and jsp's for access control through the application, but to use some
XML/XSLT
engine to actually retrieve and format the data coming from the database.
I use Oracle's XSQL Servlet, seems to work great and also seems to be less
filling (memory filling that is).

--mikej
-=-----
mike jackson
mjackson@cdi-hq.com

> -----Original Message-----
> From: Patrick Codere [mailto:patrick.codere@motovan.com]
> Sent: Monday, August 26, 2002 3:15 PM
> To: 'Tomcat Users List'
> Subject: OUT OF MEMORY ERROR
>
>
> Hi everyone,
>
> 	I have been getting this error for the past few weeks without
> solving the issue.  But I just found out that I had forgotten to close a
> database connection.  Could that have been the problem?  Time
> will tell, but
> what exactly happens when you don't close a db connection?
>
> Thanks for your help.
>
> Pat
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: OUT OF MEMORY ERROR

Posted by Jay Gardner <gj...@qwest.net>.
Hi Pat,

Not closing a database connection should not run you out of memory, unless
you have ALOT of traffic or no memory to begin with. Connections should time
out after a period of time, if you have relinquished to reference to them.
It is obviously best to close them explicitly when you are finished with
them.

How long does it take before you run out of memory? I seem to recall that
older versions of SUN's jdk had memory leaks when compiling JSP pages. Do
you only run out of memory after new JSP pages have been loaded or existing
ones have been changed? Or is this a slow leak that has some sort of
predictable behavior, like it runs out of memory three days after a restart,
etc...

Could you give more info? Without it, we are just guessing.

--Jay Gardner

-----Original Message-----
From: Patrick Codere [mailto:patrick.codere@motovan.com]
Sent: Monday, August 26, 2002 4:15 PM
To: 'Tomcat Users List'
Subject: OUT OF MEMORY ERROR

Hi everyone,

        I have been getting this error for the past few weeks without
solving the issue.  But I just found out that I had forgotten to close a
database connection.  Could that have been the problem?  Time will tell, but
what exactly happens when you don't close a db connection?

Thanks for your help.

Pat


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>