Velocity
  1. Velocity
  2. VELOCITY-161

Object reference remains in SimplePool after sucessful get()

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.3.1-rc2
    • Fix Version/s: None
    • Component/s: Engine
    • Labels:
      None
    • Environment:
      Operating System: All
      Platform: All

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

        Activity

          People

          • Assignee:
            Unassigned
            Reporter:
            Bill Boland
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development