axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 26256] New: - Memory leak in classe org.apache.axis.utils.XMLUtils
Date Mon, 19 Jan 2004 17:18:53 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26256>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26256

Memory leak in classe org.apache.axis.utils.XMLUtils

           Summary: Memory leak in classe org.apache.axis.utils.XMLUtils
           Product: Axis
           Version: 1.2 Alpha
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: Serialization/Deserialization
        AssignedTo: axis-dev@ws.apache.org
        ReportedBy: micantunes@bes.pt


Hi,

Axis has a memory leak in class  org.apache.axis.utils.XMLUtils. This class 
keeps a parser cache. The problem is that each parser is maintaining a direct 
reference for the DeserializationContextImpl instance that has created it, and 
indirect references for a bunch of other objects referenced by the 
DeserializationContextImpl instance. 

Although DeserializationContextImpl tries to clean up the parser with the line:
   public void parse() throws SAXException
    {
...
  parser.setProperty("http://xml.org/sax/properties/lexical-handler", null);

..
   }

If using xerces version > 2.4 the parser is keeping references  to the remain 
interfaces implemented by its DefaultHandler super class. To clean up the 
references it is necessary to do something like the commented code that can be 
found in the releaseSAXParser method of the XMLUtils class:
"
    public static void releaseSAXParser(SAXParser parser) {
        if(!tryReset) return;

        //Free up possible ref. held by past contenthandler.
        try{
            XMLReader xmlReader= parser.getXMLReader();
            if(null != xmlReader){
//                xmlReader.setContentHandler(doNothingContentHandler);
//                xmlReader.setDTDHandler(doNothingContentHandler);
//                xmlReader.setEntityResolver(doNothingContentHandler);
//                xmlReader.setErrorHandler(doNothingContentHandler);
                synchronized (XMLUtils.class ) {
                    saxParsers.push(parser);
                }
            }
            else {
                tryReset= false;
            }
        } catch (org.xml.sax.SAXException e) {
            tryReset= false;
        }
    }
"

I do not know why that code is commented, however, I have tried a similar set 
of instructions and it worked ok for xerces 2.4 and xerces 2.6:
"		    reader.setContentHandler(null);
		    reader.setDTDHandler(null);
		    reader.setEntityResolver(null);
		    reader.setErrorHandler(null);
"

Mime
View raw message