jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kris Schneider <k...@dotech.com>
Subject Re: Memory Leak in ELEvaluator (cont'd...)
Date Fri, 25 Feb 2005 18:56:40 GMT
Here's an approach to dynamically generating unique expressions that might work
as a test.

elcache.jsp:
------------
<%@ page import="java.io.*" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

<%
String genPath = pageContext.getServletContext().getRealPath("/generated.jsp");
PrintStream ps = null;
try {
    ps = new PrintStream(new BufferedOutputStream(new FileOutputStream(genPath,
false), 4096));

    ps.println("<%" + "@ taglib prefix=\"c\"
uri=\"http://java.sun.com/jstl/core\" %\>");
    ps.println("<html><head>");
    ps.println("<meta http-equiv=\"refresh\" content=\"3; URL=elcache.jsp\">");
    ps.println("<title>Generated</title>");
    ps.println("</head><body><ul>");

    long time = System.currentTimeMillis();
    for (int i = 0; i < 100; i++) {
        long value = time + i;
        String var = "v_" + value;
        ps.print("<li>");
        ps.print("<c:set var='" + var + "' value='${" + value + "}'/>");
        ps.print("<c:out value='${pageScope." + var + "}'/>");
        ps.println("</li>");
    }

    ps.println("</ul></body></html>");
} catch (FileNotFoundException exc) {
    exc.printStackTrace();
} finally {
    if (ps != null) {
        ps.close();
    }
}
%>

<html>

    <head>
        <meta http-equiv="refresh" content="3; URL=generated.jsp">
        <title>EL Cache Test</title>
    </head>

    <body>
        <p>EL Cache Test</p>
    </body>

</html>

If you drop this into TC's $CATALINA_HOME/webapps/ROOT and add the JSTL libs to
$CATALINA_HOME/webapps/ROOT/WEB-INF/lib, it should do what you want. I tested
this with TC 4.1.31 and Standard 1.0.6, but didn't do any sort of profiling. If
you don't see the output from generated.jsp change for each request, try
increasing the refresh interval.

-- 
Kris Schneider <mailto:kris@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org


Mime
View raw message