tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 46957] New: Memory leak: tags in JSPs don't release Page Context
Date Thu, 02 Apr 2009 18:06:39 GMT

           Summary: Memory leak: tags in JSPs don't release Page Context
           Product: Tomcat 6
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper

During investigation of memory leaks in our web-application I was checking heap
using jhat and I found that the biggest memory leak is caused by tomcat itself.
Heap contain big amount of instances of class PageContextImpl (over 1000).
These instances reference JspWriterImpl (property baseOut) which reference huge
buffer (property cb which in our case has 1MB size - in total these buffers use
over 1GB).
This situation happens during big load, my understanding (might be wrong) of
the situation is that pool containing Page Contexts is not big enough which
causes bigger number of page contexts being created and then released. But most
of them stay referenced by jsp classes via tag handlers so they can't be
garbage collected.

Partial fix could be done in method
org.apache.jasper.runtime.TagHandlerPool.reuse(Tag handler)
adding following code line at the begining of the method:

This fixes simple jsp like this:

<%@taglib prefix="c" uri=""%>
<c:if test="${true}">
   Test message

I've tested this patch and checked via jhat, reference is removed. But the
problem still remains for jsp with nested tags. My guess is that some fix
should be done in part generating servlet code from JSP to remove all
references to Page Context once the servlet finishes it's service method.

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message