You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by bu...@apache.org on 2003/04/15 21:00:58 UTC

DO NOT REPLY [Bug 19042] New: - Object reference remains in SimplePool after sucessful get()

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19042>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19042

Object reference remains in SimplePool after sucessful get()

           Summary: Object reference remains in SimplePool after sucessful
                    get()
           Product: Velocity
           Version: 1.3.1-rc2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Source
        AssignedTo: velocity-dev@jakarta.apache.org
        ReportedBy: bolandb@attbi.com


When using get() to checkout an object from the 
org.apache.velocity.util.SimplePool, the reference remains in the SimplePool 
and will only get released if the pool grows again to the peak level. The get
() operation could be easily modified to place a null value in the object 
array location where the pooled item was removed so that if the object is not 
returned to the pool (for whatever reason including exceptions), the reference 
to the object does not remain in the pool until replaced in the stack-based 
design of the SimplePool. It's just good pool management for a reusable class. 

This became obvious when exceptions occured with the VelocityServlet 
mergeTemplate() and objects were not returned to the pool. Memory profiling 
showed references to VelocityWriter objects in the pool that were not released 
until activity increased to replace the reference in the SimplePool object 
array (and the memory could then be reclaimed).

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