You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by David Frankson <df...@qwest.net> on 2001/10/12 17:21:59 UTC
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?
Dave Frankson
Re: memory leak?
Posted by David Frankson <df...@qwest.net>.
I don't have any setBufferSize() calls in my code, and I put a
System.out.println(response.getBufferSize()); and it is always 1024.
Dave
> On Fri, 12 Oct 2001, David Frankson wrote:
>
> > Date: Fri, 12 Oct 2001 10:21:59 -0500
> > From: David Frankson <df...@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
>
>
>
Re: memory leak?
Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Fri, 12 Oct 2001, David Frankson wrote:
> Date: Fri, 12 Oct 2001 10:21:59 -0500
> From: David Frankson <df...@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