You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Morten <mo...@bilpriser.dk> on 2007/08/21 13:09:47 UTC

Memory problems

Hi

We have implemented a picture server in Tomcat.
The pictures are cached in a map. When the memory is nearly full, some 
entries are removed from map.

However, eventually the entries in the map become fewer and fewer even 
though the memory consumption stays high. In other words more and more 
memory are used outside the map.

According to a heap dump done by jmap, there are many 
org.apache.tomcat.util.buf.ByteChunk instances referencing large byte[], 
which we suspect to be previously used pictures.

We have tried both Tomcat 5.5.9 and Tomcat 6 under JBoss 4.2.0. Both showed 
the same behaviour.

Are there any way to stop Tomcat from cached these large byte[] internally?
The ByteChunks are referenced from IntermediateOutputstream, C2BConverter 
and OutputBuffer.

Best regards,
Morten Knudsen




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Memory problems

Posted by Morten <mo...@bilpriser.dk>.
>> Are there any way to stop Tomcat from cached these large
>> byte[] internally?
>> The ByteChunks are referenced from IntermediateOutputstream,
>> C2BConverter and OutputBuffer.

>Hmm.  Those are all Tomcat util classes, so they're almost certainly
>held by something else.  Can you find out what's holding on to those
>instances, and make sure the chain of references goes entirely through
>Tomcat rather than via JBoss, your webapp or something you've cached in
>your session?
>
The graph looks like this:

The byte[] is referenced from:
- ByteChunk (A)
- ByteChunk (B)

ByteChunk (A) is referenced by:
- org.apache.tomcat.util.buf.C2BConverter (AA)
- org.apache.tomcat.util.buf.IntermediateOutputStream (AB)
- org.apache.catalina.connector.OutputBuffer (AC)

ByteChunk (B) is referenced by:
- org.apache.catalina.connector.OutputBuffer (AC)

C2BConverter (AA) is referenced by:
- HashMap$Entry (AAA)
- org.apache.catalina.connector.OutputBuffer (AC)

IntermediateOutputStream (AB) is referenced by:
- org.apache.tomcat.util.buf.C2BConverter (AA)
- org.apache.tomcat.util.buf.WriteConvertor (ABA)
- sun.nio.cs.StreamEnocder (ABB)

OutputBuffer (AC) is referenced by:
- org.apache.catalina.conncetor.CoyoteOutputStream (ACA)
- org.apache.catalina.connector.CoyoteWriter (ACB)
- org.apache.catalina.connector.Response (ACC)

HashMap$Entry (AAA) is referenced by:
- <class>[]

org.apache.catalina.conncetor.CoyoteOutputStream (ACA) is referenced by:
- org.apache.catalina.connector.Response (ACC)

org.apache.catalina.connector.CoyoteWriter (ACB) is referenced by:
- org.apache.catalina.connector.Response (ACC)

org.apache.catalina.connector.Response (ACC) is referenced by:
- org.apache.catalina.connector.ResponseFacade (ACCA)
- <class>[] (ACCB)
- org.apache.catalina.connector.Request (ACCC)

I cannot find any trace of any JBoss or any webapp class.

Best regards,
Morten





---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Memory problems

Posted by Peter Crowther <Pe...@melandra.com>.
> From: Morten
> According to a heap dump done by jmap, there are many 
> org.apache.tomcat.util.buf.ByteChunk instances referencing 
> large byte[], 
> which we suspect to be previously used pictures.
> 
> We have tried both Tomcat 5.5.9 and Tomcat 6 under JBoss 
> 4.2.0. Both showed 
> the same behaviour.
> 
> Are there any way to stop Tomcat from cached these large 
> byte[] internally?
> The ByteChunks are referenced from IntermediateOutputstream, 
> C2BConverter and OutputBuffer.

Hmm.  Those are all Tomcat util classes, so they're almost certainly
held by something else.  Can you find out what's holding on to those
instances, and make sure the chain of references goes entirely through
Tomcat rather than via JBoss, your webapp or something you've cached in
your session?

		- Peter

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org