You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Stephan Irrgang (JIRA)" <xe...@xml.apache.org> on 2005/08/29 14:37:04 UTC

[jira] Created: (XERCESC-1486) Memory leak in error cases

Memory leak in error cases
--------------------------

         Key: XERCESC-1486
         URL: http://issues.apache.org/jira/browse/XERCESC-1486
     Project: Xerces-C++
        Type: Bug
  Components: SAX/SAX2  
    Versions: 2.6.0    
 Environment: HP-UX B.11.11 U 9000/800
aCC: HP ANSI C++ B3910B A.03.57
 Reporter: Stephan Irrgang


Hi,

I found a memory leak using the SAX Parser  in error cases like file not found or unexcepted end of file. I first detected it with Xerces C++ release 2.3, and then verified that  it's still in contained in the latest release (2.6). Here's the source code I used to test this issue; in this example the XML file to parse is not existing.

#include <xercesc/sax/HandlerBase.hpp>
#include <xercesc/sax/AttributeList.hpp>
#include <xercesc/parsers/SAXParser.hpp>
#include <iostream.h>

using namespace XERCES_CPP_NAMESPACE;

class myCallbackHandler_c : public HandlerBase
{
public:
  void fatalError (const SAXParseException& exception)
  {
    char chBuffer[256];
    XMLString::transcode(exception.getMessage(), chBuffer, 255); 
    throw chBuffer;
  }
};

int main()
{
  int returnValue = 0;
  XMLPlatformUtils::Initialize();
  SAXParser *saxParserPtr = new SAXParser;
  myCallbackHandler_c *callbackHandlerPtr = new myCallbackHandler_c;
  saxParserPtr->setErrorHandler(callbackHandlerPtr);
  
  try
    {
      saxParserPtr->parse("FileNotFound.xml");
    }
  catch (const char* s)
    {
      cerr << s << endl;
      returnValue = 1;
    }
  catch (...)
    {
      cerr << "Unknown exception!" << endl;
      returnValue = 1;
    }
  
  delete callbackHandlerPtr;
  delete saxParserPtr;
  XMLPlatformUtils::Terminate();
  cout << "Returning: " << returnValue << endl;
  return returnValue;
}


When running it with Rational Purify it shows following memory leaks (BTW, the same leaks are shown when using HP WDB's memory check functionality).
         MLK: 186 bytes leaked at 0x400bbd08
         This memory was allocated from:
               malloc         [rtlib.o]
               __nW__fUl      [libCsup.2]
               operator new(unsigned long) [rtlib.o]
               xercesc_2_6::MemoryManagerImpl::allocate(unsigned long) [libxerces-c.sl.26.0]
               xercesc_2_6::XMLException::XMLException(const xercesc_2_6::XMLException &)%2 [libxerces-c.sl.26.0]
               xercesc_2_6::IGXMLScanner::scanReset(const xercesc_2_6::InputSource &) [libxerces-c.sl.26.0]
               xercesc_2_6::IGXMLScanner::scanDocument(const xercesc_2_6::InputSource &) [libxerces-c.sl.26.0]
               xercesc_2_6::XMLScanner::scanDocument(const unsigned short *) [libxerces-c.sl.26.0]
               xercesc_2_6::XMLScanner::scanDocument(const char *) [libxerces-c.sl.26.0]
               xercesc_2_6::SAXParser::parse(const char *) [libxerces-c.sl.26.0]
               main           [xerces_mlk.cc:29]
               _start         [libc.2]
               $START$        [crt0.o]
               $START$        [crt0.o]
         MLK: 18 bytes leaked at 0x400a7b18
         This memory was allocated from:
               malloc         [rtlib.o]
               __nW__fUl      [libCsup.2]
               operator new(unsigned long) [rtlib.o]
               xercesc_2_6::MemoryManagerImpl::allocate(unsigned long) [libxerces-c.sl.26.0]
               static xercesc_2_6::XMLString::replicate(const char *,xercesc_2_6::MemoryManager *) [libxerces-c.sl.26.0]
               xercesc_2_6::XMLException::XMLException(const xercesc_2_6::XMLException &)%2 [libxerces-c.sl.26.0]
               xercesc_2_6::IGXMLScanner::scanReset(const xercesc_2_6::InputSource &) [libxerces-c.sl.26.0]
               xercesc_2_6::IGXMLScanner::scanDocument(const xercesc_2_6::InputSource &) [libxerces-c.sl.26.0]
               xercesc_2_6::XMLScanner::scanDocument(const unsigned short *) [libxerces-c.sl.26.0]
               xercesc_2_6::XMLScanner::scanDocument(const char *) [libxerces-c.sl.26.0]
               xercesc_2_6::SAXParser::parse(const char *) [libxerces-c.sl.26.0]
               main           [xerces_mlk.cc:29]
               _start         [libc.2]
               $START$        [crt0.o]
               $START$        [crt0.o]

To me it seems the XMLException object is not released in case an exception is thrown in an error handler's fatalError method.  Any ideas? Thanks in advance!

Regards,
Stephan

-- 
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
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (XERCESC-1486) Memory leak in error cases

Posted by "Stephan Irrgang (JIRA)" <xe...@xml.apache.org>.
    [ http://issues.apache.org/jira/browse/XERCESC-1486?page=comments#action_12320586 ] 

Stephan Irrgang commented on XERCESC-1486:
------------------------------------------

Bad luck that this error only seems to exist on HP-UX. I forwarded this issue to HP; and guess what they answered: "This sounds like a bug caused by the way Xerxes accesses HP".

I strongly believe (and many times verified) that there is no general HP-UX problem in destroying exception objects. There must be some reason why this memory leak error appears only when using Xerces-C. Question is now, who is responsible for fixing this issue? As a user of both HP-UX and Xerces-C I'd assume that you guys should have a closer look...

> Memory leak in error cases
> --------------------------
>
>          Key: XERCESC-1486
>          URL: http://issues.apache.org/jira/browse/XERCESC-1486
>      Project: Xerces-C++
>         Type: Bug
>   Components: SAX/SAX2
>     Versions: 2.6.0
>  Environment: HP-UX B.11.11 U 9000/800
> aCC: HP ANSI C++ B3910B A.03.57
>     Reporter: Stephan Irrgang

>
> Hi,
> I found a memory leak using the SAX Parser  in error cases like file not found or unexcepted end of file. I first detected it with Xerces C++ release 2.3, and then verified that  it's still in contained in the latest release (2.6). Here's the source code I used to test this issue; in this example the XML file to parse is not existing.
> #include <xercesc/sax/HandlerBase.hpp>
> #include <xercesc/sax/AttributeList.hpp>
> #include <xercesc/parsers/SAXParser.hpp>
> #include <iostream.h>
> using namespace XERCES_CPP_NAMESPACE;
> class myCallbackHandler_c : public HandlerBase
> {
> public:
>   void fatalError (const SAXParseException& exception)
>   {
>     char chBuffer[256];
>     XMLString::transcode(exception.getMessage(), chBuffer, 255); 
>     throw chBuffer;
>   }
> };
> int main()
> {
>   int returnValue = 0;
>   XMLPlatformUtils::Initialize();
>   SAXParser *saxParserPtr = new SAXParser;
>   myCallbackHandler_c *callbackHandlerPtr = new myCallbackHandler_c;
>   saxParserPtr->setErrorHandler(callbackHandlerPtr);
>   
>   try
>     {
>       saxParserPtr->parse("FileNotFound.xml");
>     }
>   catch (const char* s)
>     {
>       cerr << s << endl;
>       returnValue = 1;
>     }
>   catch (...)
>     {
>       cerr << "Unknown exception!" << endl;
>       returnValue = 1;
>     }
>   
>   delete callbackHandlerPtr;
>   delete saxParserPtr;
>   XMLPlatformUtils::Terminate();
>   cout << "Returning: " << returnValue << endl;
>   return returnValue;
> }
> When running it with Rational Purify it shows following memory leaks (BTW, the same leaks are shown when using HP WDB's memory check functionality).
>          MLK: 186 bytes leaked at 0x400bbd08
>          This memory was allocated from:
>                malloc         [rtlib.o]
>                __nW__fUl      [libCsup.2]
>                operator new(unsigned long) [rtlib.o]
>                xercesc_2_6::MemoryManagerImpl::allocate(unsigned long) [libxerces-c.sl.26.0]
>                xercesc_2_6::XMLException::XMLException(const xercesc_2_6::XMLException &)%2 [libxerces-c.sl.26.0]
>                xercesc_2_6::IGXMLScanner::scanReset(const xercesc_2_6::InputSource &) [libxerces-c.sl.26.0]
>                xercesc_2_6::IGXMLScanner::scanDocument(const xercesc_2_6::InputSource &) [libxerces-c.sl.26.0]
>                xercesc_2_6::XMLScanner::scanDocument(const unsigned short *) [libxerces-c.sl.26.0]
>                xercesc_2_6::XMLScanner::scanDocument(const char *) [libxerces-c.sl.26.0]
>                xercesc_2_6::SAXParser::parse(const char *) [libxerces-c.sl.26.0]
>                main           [xerces_mlk.cc:29]
>                _start         [libc.2]
>                $START$        [crt0.o]
>                $START$        [crt0.o]
>          MLK: 18 bytes leaked at 0x400a7b18
>          This memory was allocated from:
>                malloc         [rtlib.o]
>                __nW__fUl      [libCsup.2]
>                operator new(unsigned long) [rtlib.o]
>                xercesc_2_6::MemoryManagerImpl::allocate(unsigned long) [libxerces-c.sl.26.0]
>                static xercesc_2_6::XMLString::replicate(const char *,xercesc_2_6::MemoryManager *) [libxerces-c.sl.26.0]
>                xercesc_2_6::XMLException::XMLException(const xercesc_2_6::XMLException &)%2 [libxerces-c.sl.26.0]
>                xercesc_2_6::IGXMLScanner::scanReset(const xercesc_2_6::InputSource &) [libxerces-c.sl.26.0]
>                xercesc_2_6::IGXMLScanner::scanDocument(const xercesc_2_6::InputSource &) [libxerces-c.sl.26.0]
>                xercesc_2_6::XMLScanner::scanDocument(const unsigned short *) [libxerces-c.sl.26.0]
>                xercesc_2_6::XMLScanner::scanDocument(const char *) [libxerces-c.sl.26.0]
>                xercesc_2_6::SAXParser::parse(const char *) [libxerces-c.sl.26.0]
>                main           [xerces_mlk.cc:29]
>                _start         [libc.2]
>                $START$        [crt0.o]
>                $START$        [crt0.o]
> To me it seems the XMLException object is not released in case an exception is thrown in an error handler's fatalError method.  Any ideas? Thanks in advance!
> Regards,
> Stephan

-- 
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
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Closed: (XERCESC-1486) Memory leak in error cases

Posted by "Boris Kolpackov (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESC-1486?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Boris Kolpackov closed XERCESC-1486.
------------------------------------

       Resolution: Fixed
    Fix Version/s: 3.0.1

Assuming fixed in 3.0.1. Can you please try with 3.0.1 and reopen if the issue if the problem is still present.

> Memory leak in error cases
> --------------------------
>
>                 Key: XERCESC-1486
>                 URL: https://issues.apache.org/jira/browse/XERCESC-1486
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: SAX/SAX2
>    Affects Versions: 2.6.0
>         Environment: HP-UX B.11.11 U 9000/800
> aCC: HP ANSI C++ B3910B A.03.57
>            Reporter: Stephan Irrgang
>             Fix For: 3.0.1
>
>
> Hi,
> I found a memory leak using the SAX Parser  in error cases like file not found or unexcepted end of file. I first detected it with Xerces C++ release 2.3, and then verified that  it's still in contained in the latest release (2.6). Here's the source code I used to test this issue; in this example the XML file to parse is not existing.
> #include <xercesc/sax/HandlerBase.hpp>
> #include <xercesc/sax/AttributeList.hpp>
> #include <xercesc/parsers/SAXParser.hpp>
> #include <iostream.h>
> using namespace XERCES_CPP_NAMESPACE;
> class myCallbackHandler_c : public HandlerBase
> {
> public:
>   void fatalError (const SAXParseException& exception)
>   {
>     char chBuffer[256];
>     XMLString::transcode(exception.getMessage(), chBuffer, 255); 
>     throw chBuffer;
>   }
> };
> int main()
> {
>   int returnValue = 0;
>   XMLPlatformUtils::Initialize();
>   SAXParser *saxParserPtr = new SAXParser;
>   myCallbackHandler_c *callbackHandlerPtr = new myCallbackHandler_c;
>   saxParserPtr->setErrorHandler(callbackHandlerPtr);
>   
>   try
>     {
>       saxParserPtr->parse("FileNotFound.xml");
>     }
>   catch (const char* s)
>     {
>       cerr << s << endl;
>       returnValue = 1;
>     }
>   catch (...)
>     {
>       cerr << "Unknown exception!" << endl;
>       returnValue = 1;
>     }
>   
>   delete callbackHandlerPtr;
>   delete saxParserPtr;
>   XMLPlatformUtils::Terminate();
>   cout << "Returning: " << returnValue << endl;
>   return returnValue;
> }
> When running it with Rational Purify it shows following memory leaks (BTW, the same leaks are shown when using HP WDB's memory check functionality).
>          MLK: 186 bytes leaked at 0x400bbd08
>          This memory was allocated from:
>                malloc         [rtlib.o]
>                __nW__fUl      [libCsup.2]
>                operator new(unsigned long) [rtlib.o]
>                xercesc_2_6::MemoryManagerImpl::allocate(unsigned long) [libxerces-c.sl.26.0]
>                xercesc_2_6::XMLException::XMLException(const xercesc_2_6::XMLException &)%2 [libxerces-c.sl.26.0]
>                xercesc_2_6::IGXMLScanner::scanReset(const xercesc_2_6::InputSource &) [libxerces-c.sl.26.0]
>                xercesc_2_6::IGXMLScanner::scanDocument(const xercesc_2_6::InputSource &) [libxerces-c.sl.26.0]
>                xercesc_2_6::XMLScanner::scanDocument(const unsigned short *) [libxerces-c.sl.26.0]
>                xercesc_2_6::XMLScanner::scanDocument(const char *) [libxerces-c.sl.26.0]
>                xercesc_2_6::SAXParser::parse(const char *) [libxerces-c.sl.26.0]
>                main           [xerces_mlk.cc:29]
>                _start         [libc.2]
>                $START$        [crt0.o]
>                $START$        [crt0.o]
>          MLK: 18 bytes leaked at 0x400a7b18
>          This memory was allocated from:
>                malloc         [rtlib.o]
>                __nW__fUl      [libCsup.2]
>                operator new(unsigned long) [rtlib.o]
>                xercesc_2_6::MemoryManagerImpl::allocate(unsigned long) [libxerces-c.sl.26.0]
>                static xercesc_2_6::XMLString::replicate(const char *,xercesc_2_6::MemoryManager *) [libxerces-c.sl.26.0]
>                xercesc_2_6::XMLException::XMLException(const xercesc_2_6::XMLException &)%2 [libxerces-c.sl.26.0]
>                xercesc_2_6::IGXMLScanner::scanReset(const xercesc_2_6::InputSource &) [libxerces-c.sl.26.0]
>                xercesc_2_6::IGXMLScanner::scanDocument(const xercesc_2_6::InputSource &) [libxerces-c.sl.26.0]
>                xercesc_2_6::XMLScanner::scanDocument(const unsigned short *) [libxerces-c.sl.26.0]
>                xercesc_2_6::XMLScanner::scanDocument(const char *) [libxerces-c.sl.26.0]
>                xercesc_2_6::SAXParser::parse(const char *) [libxerces-c.sl.26.0]
>                main           [xerces_mlk.cc:29]
>                _start         [libc.2]
>                $START$        [crt0.o]
>                $START$        [crt0.o]
> To me it seems the XMLException object is not released in case an exception is thrown in an error handler's fatalError method.  Any ideas? Thanks in advance!
> Regards,
> Stephan

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (XERCESC-1486) Memory leak in error cases

Posted by "David Bertoni (JIRA)" <xe...@xml.apache.org>.
    [ http://issues.apache.org/jira/browse/XERCESC-1486?page=comments#action_12320601 ] 

David Bertoni commented on XERCESC-1486:
----------------------------------------

I suggest you build a version of Xerces-C with some logging the XMLException constructor and destructor to ensure that it is called and that the pointer is freed.  If it is, you will know that it's a problem with the memory leak detection tools.  If it's not, you'll know it a problem with the compiler, and you can report it to HP.

It's often difficult for the Xerces-C committers to diagnose platform-specific problems, because none of us has access to every possible platform.

> Memory leak in error cases
> --------------------------
>
>          Key: XERCESC-1486
>          URL: http://issues.apache.org/jira/browse/XERCESC-1486
>      Project: Xerces-C++
>         Type: Bug
>   Components: SAX/SAX2
>     Versions: 2.6.0
>  Environment: HP-UX B.11.11 U 9000/800
> aCC: HP ANSI C++ B3910B A.03.57
>     Reporter: Stephan Irrgang

>
> Hi,
> I found a memory leak using the SAX Parser  in error cases like file not found or unexcepted end of file. I first detected it with Xerces C++ release 2.3, and then verified that  it's still in contained in the latest release (2.6). Here's the source code I used to test this issue; in this example the XML file to parse is not existing.
> #include <xercesc/sax/HandlerBase.hpp>
> #include <xercesc/sax/AttributeList.hpp>
> #include <xercesc/parsers/SAXParser.hpp>
> #include <iostream.h>
> using namespace XERCES_CPP_NAMESPACE;
> class myCallbackHandler_c : public HandlerBase
> {
> public:
>   void fatalError (const SAXParseException& exception)
>   {
>     char chBuffer[256];
>     XMLString::transcode(exception.getMessage(), chBuffer, 255); 
>     throw chBuffer;
>   }
> };
> int main()
> {
>   int returnValue = 0;
>   XMLPlatformUtils::Initialize();
>   SAXParser *saxParserPtr = new SAXParser;
>   myCallbackHandler_c *callbackHandlerPtr = new myCallbackHandler_c;
>   saxParserPtr->setErrorHandler(callbackHandlerPtr);
>   
>   try
>     {
>       saxParserPtr->parse("FileNotFound.xml");
>     }
>   catch (const char* s)
>     {
>       cerr << s << endl;
>       returnValue = 1;
>     }
>   catch (...)
>     {
>       cerr << "Unknown exception!" << endl;
>       returnValue = 1;
>     }
>   
>   delete callbackHandlerPtr;
>   delete saxParserPtr;
>   XMLPlatformUtils::Terminate();
>   cout << "Returning: " << returnValue << endl;
>   return returnValue;
> }
> When running it with Rational Purify it shows following memory leaks (BTW, the same leaks are shown when using HP WDB's memory check functionality).
>          MLK: 186 bytes leaked at 0x400bbd08
>          This memory was allocated from:
>                malloc         [rtlib.o]
>                __nW__fUl      [libCsup.2]
>                operator new(unsigned long) [rtlib.o]
>                xercesc_2_6::MemoryManagerImpl::allocate(unsigned long) [libxerces-c.sl.26.0]
>                xercesc_2_6::XMLException::XMLException(const xercesc_2_6::XMLException &)%2 [libxerces-c.sl.26.0]
>                xercesc_2_6::IGXMLScanner::scanReset(const xercesc_2_6::InputSource &) [libxerces-c.sl.26.0]
>                xercesc_2_6::IGXMLScanner::scanDocument(const xercesc_2_6::InputSource &) [libxerces-c.sl.26.0]
>                xercesc_2_6::XMLScanner::scanDocument(const unsigned short *) [libxerces-c.sl.26.0]
>                xercesc_2_6::XMLScanner::scanDocument(const char *) [libxerces-c.sl.26.0]
>                xercesc_2_6::SAXParser::parse(const char *) [libxerces-c.sl.26.0]
>                main           [xerces_mlk.cc:29]
>                _start         [libc.2]
>                $START$        [crt0.o]
>                $START$        [crt0.o]
>          MLK: 18 bytes leaked at 0x400a7b18
>          This memory was allocated from:
>                malloc         [rtlib.o]
>                __nW__fUl      [libCsup.2]
>                operator new(unsigned long) [rtlib.o]
>                xercesc_2_6::MemoryManagerImpl::allocate(unsigned long) [libxerces-c.sl.26.0]
>                static xercesc_2_6::XMLString::replicate(const char *,xercesc_2_6::MemoryManager *) [libxerces-c.sl.26.0]
>                xercesc_2_6::XMLException::XMLException(const xercesc_2_6::XMLException &)%2 [libxerces-c.sl.26.0]
>                xercesc_2_6::IGXMLScanner::scanReset(const xercesc_2_6::InputSource &) [libxerces-c.sl.26.0]
>                xercesc_2_6::IGXMLScanner::scanDocument(const xercesc_2_6::InputSource &) [libxerces-c.sl.26.0]
>                xercesc_2_6::XMLScanner::scanDocument(const unsigned short *) [libxerces-c.sl.26.0]
>                xercesc_2_6::XMLScanner::scanDocument(const char *) [libxerces-c.sl.26.0]
>                xercesc_2_6::SAXParser::parse(const char *) [libxerces-c.sl.26.0]
>                main           [xerces_mlk.cc:29]
>                _start         [libc.2]
>                $START$        [crt0.o]
>                $START$        [crt0.o]
> To me it seems the XMLException object is not released in case an exception is thrown in an error handler's fatalError method.  Any ideas? Thanks in advance!
> Regards,
> Stephan

-- 
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
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (XERCESC-1486) Memory leak in error cases

Posted by "David Bertoni (JIRA)" <xe...@xml.apache.org>.
    [ http://issues.apache.org/jira/browse/XERCESC-1486?page=comments#action_12320464 ] 

David Bertoni commented on XERCESC-1486:
----------------------------------------

I cannot reproduce this on Windows, so it looks like a problem that's specific to the HP compiler.  It's the compiler/run-time library that's responsible for calling the destructor for the XMLException instance that's created in IGXMLScanner::scanReset(), so it it's not getting destroyed, it's not a Xerces-C bug.  Note this could also be a bug with Purify.

I would suggest you add an infinite loop around the try/catch block and run the executable for a while to see if the process memory continues to grow.  If it does, there's a leak, and you should pursue a fix with HP.

> Memory leak in error cases
> --------------------------
>
>          Key: XERCESC-1486
>          URL: http://issues.apache.org/jira/browse/XERCESC-1486
>      Project: Xerces-C++
>         Type: Bug
>   Components: SAX/SAX2
>     Versions: 2.6.0
>  Environment: HP-UX B.11.11 U 9000/800
> aCC: HP ANSI C++ B3910B A.03.57
>     Reporter: Stephan Irrgang

>
> Hi,
> I found a memory leak using the SAX Parser  in error cases like file not found or unexcepted end of file. I first detected it with Xerces C++ release 2.3, and then verified that  it's still in contained in the latest release (2.6). Here's the source code I used to test this issue; in this example the XML file to parse is not existing.
> #include <xercesc/sax/HandlerBase.hpp>
> #include <xercesc/sax/AttributeList.hpp>
> #include <xercesc/parsers/SAXParser.hpp>
> #include <iostream.h>
> using namespace XERCES_CPP_NAMESPACE;
> class myCallbackHandler_c : public HandlerBase
> {
> public:
>   void fatalError (const SAXParseException& exception)
>   {
>     char chBuffer[256];
>     XMLString::transcode(exception.getMessage(), chBuffer, 255); 
>     throw chBuffer;
>   }
> };
> int main()
> {
>   int returnValue = 0;
>   XMLPlatformUtils::Initialize();
>   SAXParser *saxParserPtr = new SAXParser;
>   myCallbackHandler_c *callbackHandlerPtr = new myCallbackHandler_c;
>   saxParserPtr->setErrorHandler(callbackHandlerPtr);
>   
>   try
>     {
>       saxParserPtr->parse("FileNotFound.xml");
>     }
>   catch (const char* s)
>     {
>       cerr << s << endl;
>       returnValue = 1;
>     }
>   catch (...)
>     {
>       cerr << "Unknown exception!" << endl;
>       returnValue = 1;
>     }
>   
>   delete callbackHandlerPtr;
>   delete saxParserPtr;
>   XMLPlatformUtils::Terminate();
>   cout << "Returning: " << returnValue << endl;
>   return returnValue;
> }
> When running it with Rational Purify it shows following memory leaks (BTW, the same leaks are shown when using HP WDB's memory check functionality).
>          MLK: 186 bytes leaked at 0x400bbd08
>          This memory was allocated from:
>                malloc         [rtlib.o]
>                __nW__fUl      [libCsup.2]
>                operator new(unsigned long) [rtlib.o]
>                xercesc_2_6::MemoryManagerImpl::allocate(unsigned long) [libxerces-c.sl.26.0]
>                xercesc_2_6::XMLException::XMLException(const xercesc_2_6::XMLException &)%2 [libxerces-c.sl.26.0]
>                xercesc_2_6::IGXMLScanner::scanReset(const xercesc_2_6::InputSource &) [libxerces-c.sl.26.0]
>                xercesc_2_6::IGXMLScanner::scanDocument(const xercesc_2_6::InputSource &) [libxerces-c.sl.26.0]
>                xercesc_2_6::XMLScanner::scanDocument(const unsigned short *) [libxerces-c.sl.26.0]
>                xercesc_2_6::XMLScanner::scanDocument(const char *) [libxerces-c.sl.26.0]
>                xercesc_2_6::SAXParser::parse(const char *) [libxerces-c.sl.26.0]
>                main           [xerces_mlk.cc:29]
>                _start         [libc.2]
>                $START$        [crt0.o]
>                $START$        [crt0.o]
>          MLK: 18 bytes leaked at 0x400a7b18
>          This memory was allocated from:
>                malloc         [rtlib.o]
>                __nW__fUl      [libCsup.2]
>                operator new(unsigned long) [rtlib.o]
>                xercesc_2_6::MemoryManagerImpl::allocate(unsigned long) [libxerces-c.sl.26.0]
>                static xercesc_2_6::XMLString::replicate(const char *,xercesc_2_6::MemoryManager *) [libxerces-c.sl.26.0]
>                xercesc_2_6::XMLException::XMLException(const xercesc_2_6::XMLException &)%2 [libxerces-c.sl.26.0]
>                xercesc_2_6::IGXMLScanner::scanReset(const xercesc_2_6::InputSource &) [libxerces-c.sl.26.0]
>                xercesc_2_6::IGXMLScanner::scanDocument(const xercesc_2_6::InputSource &) [libxerces-c.sl.26.0]
>                xercesc_2_6::XMLScanner::scanDocument(const unsigned short *) [libxerces-c.sl.26.0]
>                xercesc_2_6::XMLScanner::scanDocument(const char *) [libxerces-c.sl.26.0]
>                xercesc_2_6::SAXParser::parse(const char *) [libxerces-c.sl.26.0]
>                main           [xerces_mlk.cc:29]
>                _start         [libc.2]
>                $START$        [crt0.o]
>                $START$        [crt0.o]
> To me it seems the XMLException object is not released in case an exception is thrown in an error handler's fatalError method.  Any ideas? Thanks in advance!
> Regards,
> Stephan

-- 
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
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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