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=22693>.
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=22693

Memory leak in xerces library

           Summary: Memory leak in xerces library
           Product: Xerces-C++
           Version: 2.3.0
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Validating Parser (DTD)
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Hi,

Am developing an application on Solaris 2.8 using the
Xerces SAX2 parser (library 
version 2.3.0) in which I
do validation using an external DTD. Am facing a memory
leak in the 
app in both the following cases: 

a. XML document gets parsed successfully, 
b. XML 
document fails to parse due to DTD validation failure.

To verify whether this leak is in the 
library code or
my application, I instrumented the SAX2Count application
(provided in the 
Xerces package) with purify (Version
2003.06.00 Solaris 2) and ran the same giving it 
the
XML document written below. I got the following purify
report. 

-------------- Purify report for 
sample begin --------------
MLK: 24 bytes leaked at 0xcceb8
  * This memory was allocated from:
        malloc         
[rtlib.o]
        new_eh_context [libgcc2.c]
        eh_context_specific 
[libgcc2.c]
        eh_context_initialize [libgcc2.c]
        __get_eh_info  
[libgcc2.c]
        __cp_push_exception 
[exception.cc:215]
        xercesc_2_3::XMLURL::setURL(const unsigned short*,const 
unsigned short*) [libxerces-
c.so.23]
        xercesc_2_3::XMLURL::xercesc_2_3::XMLURL(const unsigned short*,const 
unsigned short*,xercesc_2_3::MemoryManager*) [libxerces-
c.so.23]
        xercesc_2_3::ReaderMgr::createReader(const unsigned short*,const unsigned 
short*,bool,xercesc_2_3::XMLReader::RefFrom,xercesc_2_3::XMLReader::Types,xercesc_2_3::XMLReader::Sources,xercesc_2_3::InputSource*&,bool)
 
[libxerces-c.so.23]
        xercesc_2_3::IGXMLScanner::scanDocTypeDecl() [libxerces-
c.so.23]
        xercesc_2_3::XMLScanner::scanProlog() [libxerces-
c.so.23]
        xercesc_2_3::IGXMLScanner::scanDocument(const 
xercesc_2_3::InputSource&) [libxerces-
c.so.23]
        xercesc_2_3::XMLScanner::scanDocument(const unsigned short*) [libxerces-
c.so.23]
        xercesc_2_3::XMLScanner::scanDocument(const char*) [libxerces-
c.so.23]
        xercesc_2_3::SAX2XMLReaderImpl::parse(const char*) [libxerces-
c.so.23]
        main           [SAX2Count.o]
        _start         [crt1.o]
--------------- Purify report for sample end ---------------

The 
leak is not in the same location as where I got it
for my app, but even my leak is caused due to an 
exception
thrown within the Xerces DTDValidator code. Is there an
issue in which the 
exceptions are thrown? Or is there
some problem with purify?

The difference between 
SAX2Count and my app is that I've
implemented the resolveEntity(), error() and 
fatalError()
callbacks in my cbk handler.

-------------- Purify report for my app begin --------------
MLK: 24 bytes 
leaked at 0x116f50
  * This memory was allocated from:
        malloc         [rtlib.o]
        new_eh_context 
[libgcc2.c]
        eh_context_specific [libgcc2.c]
        eh_context_initialize 
[libgcc2.c]
        __get_eh_info  [libgcc2.c]
        __cp_push_exception 
[exception.cc:215]
        xercesc_2_3::ReaderMgr::popReader() [libxerces-
c.so.23]
        xercesc_2_3::ReaderMgr::skipPastSpaces() [libxerces-
c.so.23]
        xercesc_2_3::DTDScanner::scanExtSubsetDecl(bool,bool) [libxerces-
c.so.23]
        xercesc_2_3::IGXMLScanner::scanDocTypeDecl() [libxerces-
c.so.23]
        xercesc_2_3::XMLScanner::scanProlog() [libxerces-
c.so.23]
        xercesc_2_3::IGXMLScanner::scanDocument(const 
xercesc_2_3::InputSource&) [libxerces-
c.so.23]
        xercesc_2_3::XMLScanner::scanDocument(const unsigned short*) [libxerces-
c.so.23]
        xercesc_2_3::XMLScanner::scanDocument(const char*) [libxerces-
c.so.23]
        xercesc_2_3::SAX2XMLReaderImpl::parse(const char*) [libxerces-
c.so.23]
        Sdf_fn_parseCPL(const char*,Sdf_tg_cplStruct**,unsigned int*) 
[sdfcplxerparser.cpp:1220]
        main           [sdfcplutility.cpp:1443]
        _start         [crt1.o]
--------------- 
Purify report for my app end ---------------

Can you please investigate? Also, please let me know
in case 
you need any further inputs? I would have liked
to attatch the XML and the DTD files, but I don't 
see
a way of doing that in the web interface. Please mail
me in case you need those to 
investigate.

Thanks for your help.
Siddharth.

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

Reply via email to