Uploaded image for project: 'Velocity'
  1. Velocity
  2. VELOCITY-161

Object reference remains in SimplePool after sucessful get()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.3.1-rc2
    • None
    • Engine
    • None
    • Operating System: All
      Platform: All
    • 19042

    Description

      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).

      Attachments

        1. ASF.LICENSE.NOT.GRANTED--SimplePool.patch
          0.8 kB
          Will Glass-Husain

        Activity

          People

            Unassigned Unassigned
            bolandb@attbi.com Bill Boland
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: