axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [jira] Commented: (AXIS-1202) Memory leak in classe org.apache.axis.utils.XMLUtils
Date Mon, 10 May 2004 23:59:56 GMT
The following comment has been added to this issue:

     Author: Simon Fell
    Created: Mon, 10 May 2004 4:59 PM
       Body:
This also applies to Axis 1.1, we found that setting the DTDHandler to null wouldn't work
(caused NPE), and had to add a doNothing handler.

Anyone know why thoses lines were commented out (Glen?) ?
---------------------------------------------------------------------
View this comment:
  http://issues.apache.org/jira/browse/AXIS-1202?page=comments#action_35483

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/AXIS-1202

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: AXIS-1202
    Summary: Memory leak in classe org.apache.axis.utils.XMLUtils
       Type: Bug

     Status: Open

    Project: Axis
 Components: 
             Serialization/Deserialization
   Versions:
             1.2 Alpha

   Assignee: Axis Developers Mailing List
   Reporter: Miguel Antunes

    Created: Mon, 19 Jan 2004 5:18 PM
    Updated: Mon, 10 May 2004 4:59 PM
Environment: Operating System: All
Platform: All

Description:
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);
"


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


Mime
View raw message