Hi Jeremy,

Thanks for the patch; I've just applied it.

Cheers,
Neil

Neil Graham
XML Parser Development
IBM Toronto Lab
Phone:  416-448-3519, T/L 778-3519
E-mail:  [EMAIL PROTECTED]



Jeremy Carroll <[EMAIL PROTECTED]>@hplb.hpl.hp.com on 08/08/2001 06:42:10
AM

Please respond to [EMAIL PROTECTED]

Sent by:  [EMAIL PROTECTED]


To:   [EMAIL PROTECTED]
cc:
Subject:  Re: Fix for memory leak in StringReader


[EMAIL PROTECTED] wrote:

> Hi Jeremy,
>
> Just FYI, the best way to submit patches is as follows:
>
> - Run a cvs diff on each file you've changed;
> - then submit each file *as an attachment* in a message to the list,
> clearly indicating just what's being corrected.

I attach a patch file for Glenn's modification to my fix.

This fixes a memory leak, in that after parsing any StringReader s waiting
to
be recycled in StringReader.fgFreeReaders should not refer to other
objects,
such as the XMLParser.

Jeremy



Index: org/apache/xerces/readers/StringReader.java
===================================================================
RCS file:
/home/cvspublic/xml-xerces/java/src/org/apache/xerces/readers/StringReader.java,v

retrieving revision 1.10
diff -u -r1.10 StringReader.java
--- org/apache/xerces/readers/StringReader.java          2000/10/26
17:59:09        1.10
+++ org/apache/xerces/readers/StringReader.java          2001/08/08
10:34:10
@@ -218,6 +218,9 @@
         synchronized (StringReader.class) {
             fNextFreeReader = fgFreeReaders;
             fgFreeReaders = this;
+            // Allow these following two fields to be GC-ed.
+            fStringPool = null;
+            fData = null;
         }
         return nextReader;
     }
Index: org/apache/xerces/readers/XMLEntityReader.java
===================================================================
RCS file:
/home/cvspublic/xml-xerces/java/src/org/apache/xerces/readers/XMLEntityReader.java,v

retrieving revision 1.2
diff -u -r1.2 XMLEntityReader.java
--- org/apache/xerces/readers/XMLEntityReader.java            2000/04/04
21:14:25        1.2
+++ org/apache/xerces/readers/XMLEntityReader.java            2001/08/08
10:34:11
@@ -167,6 +167,10 @@
         if (fStillActive) {
             nextReader = fEntityHandler.changeReaders();
             fStillActive = false;
+           // Allow these following three fields to be GC-ed.
+            fEntityHandler = null;
+            fErrorReporter = null;
+            fCharDataHandler = null;
         }
         return nextReader;
     }

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to