[
https://issues.apache.org/jira/browse/VELOCITY-160?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Henning Schmiedehausen closed VELOCITY-160.
-------------------------------------------
> Pooled VelocityWriters in VelocityServlet do not release Writer until recycled
> ------------------------------------------------------------------------------
>
> Key: VELOCITY-160
> URL: https://issues.apache.org/jira/browse/VELOCITY-160
> Project: Velocity
> Issue Type: Bug
> Components: Engine
> Affects Versions: 1.3.1-rc2
> Environment: Operating System: All
> Platform: All
> Reporter: Bill Boland
> Assigned To: Velocity-Dev List
> Fix For: 1.4
>
>
> Based on some memory debugging with Tomcat and ServletExec servlet engines,
> we
> have noticed that the VelocityWriter objects in the VelocityServlet keep a
> reference to the OutputStreamWriter when placed into the SimplePool until the
> VelocityWriter object is removed from the pool and recycled. The effect of
> this retained reference causes the response and request objects to remain in
> memeory and, depending on the implementation, the attributes for the request
> and response objects remain as well.
> By removing the reference to the OutputStreamWriter from the VelocityWriter
> (i.e. setting it to null) before placing it back into the pool, the system
> will be able to reclaim the request and response objects. Although this would
> not be noticed much on a busy system where there are requests exhausting the
> pooled objects, when activity drops and many VelocityWriters are retained in
> the pool, this can cause large amounts of memory to be wasted until the
> VelocityWriter is recycled if request attributes to large objects are still
> retained.
> In the finally block of the mergeTemplate method, the VelocityWriter could be
> recycled with a null value for the Writer *before* being placed into the pool
> (or some other *reset* method could be added to the VW):
> vw.flush();
> vw.recycle( null ); // or vw.reset();
> writerPool.put(vw);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]