Return-Path: Delivered-To: apmail-xml-xalan-cvs-archive@xml.apache.org Received: (qmail 47080 invoked by uid 500); 6 Dec 2002 15:39:02 -0000 Mailing-List: contact xalan-cvs-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: Delivered-To: mailing list xalan-cvs@xml.apache.org Received: (qmail 47035 invoked from network); 6 Dec 2002 15:39:01 -0000 Date: 6 Dec 2002 15:39:01 -0000 Message-ID: <20021206153901.42381.qmail@icarus.apache.org> From: mkwan@apache.org To: xml-xalan-cvs@apache.org Subject: cvs commit: xml-xalan/java/src/org/apache/xpath/axes AxesWalker.java ChildTestIterator.java MatchPatternIterator.java OneStepIterator.java ReverseAxesWalker.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N mkwan 2002/12/06 07:39:01 Modified: java/src/org/apache/xpath/axes AxesWalker.java ChildTestIterator.java MatchPatternIterator.java OneStepIterator.java ReverseAxesWalker.java Log: Fix the memory leak problem in Bug 6075. In the detach() method, null out the fields in the iterators that will be reassigned a value upon the next usage. This change fixes the problem that the iterators in the IteratorPool can indirectly reference the TransformerImpl object. Revision Changes Path 1.25 +1 -0 xml-xalan/java/src/org/apache/xpath/axes/AxesWalker.java Index: AxesWalker.java =================================================================== RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/AxesWalker.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- AxesWalker.java 27 Jun 2002 14:50:54 -0000 1.24 +++ AxesWalker.java 6 Dec 2002 15:39:00 -0000 1.25 @@ -216,6 +216,7 @@ { m_currentNode = DTM.NULL; m_dtm = null; + m_traverser = null; m_isFresh = true; m_root = DTM.NULL; } 1.15 +17 -0 xml-xalan/java/src/org/apache/xpath/axes/ChildTestIterator.java Index: ChildTestIterator.java =================================================================== RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/ChildTestIterator.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- ChildTestIterator.java 22 Mar 2002 01:04:42 -0000 1.14 +++ ChildTestIterator.java 6 Dec 2002 15:39:01 -0000 1.15 @@ -198,5 +198,22 @@ return org.apache.xml.dtm.Axis.CHILD; } + /** + * Detaches the iterator from the set which it iterated over, releasing + * any computational resources and placing the iterator in the INVALID + * state. Afterdetach has been invoked, calls to + * nextNode orpreviousNode will raise the + * exception INVALID_STATE_ERR. + */ + public void detach() + { + if(m_allowDetach) + { + m_traverser = null; + + // Always call the superclass detach last! + super.detach(); + } + } } 1.5 +18 -0 xml-xalan/java/src/org/apache/xpath/axes/MatchPatternIterator.java Index: MatchPatternIterator.java =================================================================== RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/MatchPatternIterator.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- MatchPatternIterator.java 22 Mar 2002 01:04:42 -0000 1.4 +++ MatchPatternIterator.java 6 Dec 2002 15:39:01 -0000 1.5 @@ -205,6 +205,24 @@ super.setRoot(context, environment); m_traverser = m_cdtm.getAxisTraverser(m_superAxis); } + + /** + * Detaches the iterator from the set which it iterated over, releasing + * any computational resources and placing the iterator in the INVALID + * state. Afterdetach has been invoked, calls to + * nextNode orpreviousNode will raise the + * exception INVALID_STATE_ERR. + */ + public void detach() + { + if(m_allowDetach) + { + m_traverser = null; + + // Always call the superclass detach last! + super.detach(); + } + } /** * Get the next node via getNextXXX. Bottlenecked for derived class override. 1.10 +19 -0 xml-xalan/java/src/org/apache/xpath/axes/OneStepIterator.java Index: OneStepIterator.java =================================================================== RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/OneStepIterator.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- OneStepIterator.java 13 Nov 2002 22:08:21 -0000 1.9 +++ OneStepIterator.java 6 Dec 2002 15:39:01 -0000 1.10 @@ -76,6 +76,25 @@ m_iterator = m_cdtm.getAxisIterator(m_axis); m_iterator.setStartNode(m_context); } + + /** + * Detaches the iterator from the set which it iterated over, releasing + * any computational resources and placing the iterator in the INVALID + * state. Afterdetach has been invoked, calls to + * nextNode orpreviousNode will raise the + * exception INVALID_STATE_ERR. + */ + public void detach() + { + if(m_allowDetach) + { + if(m_axis > -1) + m_iterator = null; + + // Always call the superclass detach last! + super.detach(); + } + } /** * Get the next node via getFirstAttribute && getNextAttribute. 1.11 +11 -0 xml-xalan/java/src/org/apache/xpath/axes/ReverseAxesWalker.java Index: ReverseAxesWalker.java =================================================================== RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/ReverseAxesWalker.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- ReverseAxesWalker.java 22 Mar 2002 01:04:43 -0000 1.10 +++ ReverseAxesWalker.java 6 Dec 2002 15:39:01 -0000 1.11 @@ -100,6 +100,17 @@ m_iterator = getDTM(root).getAxisIterator(m_axis); m_iterator.setStartNode(root); } + + /** + * Detaches the walker from the set which it iterated over, releasing + * any computational resources and placing the iterator in the INVALID + * state. + */ + public void detach() + { + m_iterator = null; + super.detach(); + } /** * Get the next node in document order on the axes. --------------------------------------------------------------------- To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org For additional commands, e-mail: xalan-cvs-help@xml.apache.org