Details
-
Bug
-
Status: Resolved
-
Resolution: Fixed
-
2.2.0
-
None
-
None
-
Operating System: Windows NT/2K
Platform: PC
-
6075
Description
The Problem
------------
The "Templates" object maintains a pool of Iterators in order to improve
performance – rather than create new Iterators during the XSL transformation,
it reuses Iterators from the pool. Unfortunately, there is am indirect
reference from the "free" Iterator to the "Transformer" object that last used
it. That means that the "Transformer" object is still referenced, and it is not
freed by the garbage collector when we are done with it. It is not freed until
the next time the same page is displayed. At that time, the Iterator is reused
and the stale reference is clear. Unfortunately, we now have a reference to the
new "Transformer" object.
The overall effect is that we have at least one lingering "Transformer" object
for each "Templates". Each "Transformer" object (and its children) can
sometimes add up to 2Mb of heap memory.
The Fix
-------
Alter the code to destroy Iterators rather than add them to the free pool.
org/apache/xpath/axes/IteratorPool.java
/**
- Add an instance of the given object to the pool
*
* - @param obj Object to add.
*/
public synchronized void freeInstance(DTMIterator obj) { // -------------------------------------------- // Destroy Iterator rather than add to pool // m_freeStack.addElement(obj); // -------------------------------------------- }
The Result
----------
No noticable problems with perform
All TransformImpl objects are cleared in the next call to system.gc()
I used "JPROBE" to track lingering objects.