You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2010/03/16 21:47:04 UTC

svn commit: r923974 - in /xerces/java/trunk/src/org/apache/xml/serialize: BaseMarkupSerializer.java DOMSerializerImpl.java

Author: mrglavas
Date: Tue Mar 16 20:47:04 2010
New Revision: 923974

URL: http://svn.apache.org/viewvc?rev=923974&view=rev
Log:
Once the LSSerializer (or XMLSerializer) has completed serializing the DOM drop internal references to the nodes from the Document. If the application is pooling serializers this will allow the garbage collector to reclaim the Document and all of its nodes if the application no longer has any references to it.

Modified:
    xerces/java/trunk/src/org/apache/xml/serialize/BaseMarkupSerializer.java
    xerces/java/trunk/src/org/apache/xml/serialize/DOMSerializerImpl.java

Modified: xerces/java/trunk/src/org/apache/xml/serialize/BaseMarkupSerializer.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xml/serialize/BaseMarkupSerializer.java?rev=923974&r1=923973&r2=923974&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xml/serialize/BaseMarkupSerializer.java (original)
+++ xerces/java/trunk/src/org/apache/xml/serialize/BaseMarkupSerializer.java Tue Mar 16 20:47:04 2010
@@ -330,6 +330,9 @@ public abstract class BaseMarkupSerializ
         return true;
     }
 
+    protected void cleanup() {
+        fCurrentNode = null;
+    }
 
     protected void prepare()
         throws IOException
@@ -402,6 +405,7 @@ public abstract class BaseMarkupSerializ
         reset();
         prepare();
         serializeNode( elem );
+        cleanup();
         _printer.flush();
         if ( _printer.getException() != null )
             throw _printer.getException();
@@ -423,6 +427,7 @@ public abstract class BaseMarkupSerializ
         reset();
         prepare();
         serializeNode( frag );
+        cleanup();
         _printer.flush();
         if ( _printer.getException() != null )
             throw _printer.getException();
@@ -445,6 +450,7 @@ public abstract class BaseMarkupSerializ
         prepare();
         serializeNode( doc );
         serializePreRoot();
+        cleanup();
         _printer.flush();
         if ( _printer.getException() != null )
             throw _printer.getException();

Modified: xerces/java/trunk/src/org/apache/xml/serialize/DOMSerializerImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xml/serialize/DOMSerializerImpl.java?rev=923974&r1=923973&r2=923974&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xml/serialize/DOMSerializerImpl.java (original)
+++ xerces/java/trunk/src/org/apache/xml/serialize/DOMSerializerImpl.java Tue Mar 16 20:47:04 2010
@@ -1047,7 +1047,7 @@ public class DOMSerializerImpl implement
             break;
         }        
         }
-               
+        fLocator.fRelatedNode = null;
     }
     
     private String _getXmlVersion(Node node) {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org