https://issues.apache.org/bugzilla/show_bug.cgi?id=50661

           Summary: c:forEach tag doesn't release his list - it causes
                    temporary memory leak
           Product: Taglibs
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Standard Taglib
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: sergiusz.brzezin...@supersystem.pl


Sorry for my English.

In <c:forEach> implementation, there are two internal variables: rawItems and
items. They hold a list, which is iterated with <c:forEach> statement. The
problem is, that after the iteration has finished, the variables still hold the
list! It would not be a problem if the Tag would be released after request
ends. But IT IS a problem because the Tag (according to JSP specification)
remains in memory and can be reused later by another request.

So, it is possible, that the list which is held by rawItems, remains in memory
many hours until another request releases it. If there ist a VERY BIG LIST with
VERY BIG OBJECTS, it could be a VERY BIG PROBLEM with memory on JVM. And it was
- on my server.

I did a workaround of this. I made a class which extendeds ForEachTag and I
wrote such method:

@Override
public int doEndTag() throws JspException
{
    int wynik = super.doEndTag();
    this.rawItems = null ;
    this.items = null ;
    return wynik ;
}

Now I use my own forEach tag.

I think, such "memory optimalization" should be made in a standard
implementation.

Sergiusz

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to