tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: memory leak?
Date Fri, 12 Oct 2001 15:59:57 GMT


On Fri, 12 Oct 2001, David Frankson wrote:

> Date: Fri, 12 Oct 2001 10:21:59 -0500
> From: David Frankson <dfrankson@qwest.net>
> Reply-To: tomcat-dev@jakarta.apache.org
> To: tomcat-dev@jakarta.apache.org
> Subject: memory leak?
>
>     I've been using Tomcat 3.2.3 in a production environment for a
> couple months without a problem.  Last week I added a new feature and
> now the tomcat process will consume memory until it reaches the
> -Xmx512 size I have set.
>
> I ran the same webapp under Tomcat 4.0 and I see the same behavior.
> However, I ran the same webapp under resin 2.0.2 and there is no
> evidence of a memory leak.
>
> I downloaded JProbe to take a look at the heap, and the most
> interesting thing I found was that there was a 33Mb byte[] referenced
> by HttpResponseAdapter.  I didn't see any objects from my application
> code that weren't supposed to be there.
>
> Has anyone encountered something like this?  What in my application
> can cause Tomcat to hold onto memory and never release it?
>

I don't know if this is what's going on in your case, but here is one way
this could happen.

The application gets to set the size of the response buffer (i.e. the
amount of stuff you can write without committing the response first), by
calling response.setBufferSize().  It is also legal for the container to
give you back a buffer bigger than the one you asked for -- so it may be
that the container keeps reusing the same buffer from then on.  Is there
any chance that your application did a setBufferSize() with a very large
value somewhere along the way?

> Dave Frankson
>

Craig



Mime
View raw message