Title: Unhandled exception and memory leaks in XPath

Hi,

I am currently using the XPathWrapper example as a model for my application.  I've created a pointer to an object from the XalanSourceTreeParserLiaison class and allocated memory using "new". 

                m_pLiaison                      = new XalanSourceTreeParserLiaison(*m_pDOMSupport);

However, whenever I attempt to delete the object (m_pLiaison) I get a "Unhandled exception in XalanSourceTreeD.DLL:  Access Violation" error.

If I don't do a delete, then I get memory leaks in areas where the element and comment nodes are created in the XalanSourceTreeContentHandler.  It appears that XalanSourceTreeDocument::createElementNode(...) and XalanSourceTreeDocument::createCommentNode(...) do not clean up the memory once the objects are created and added to the Xalan Source Tree.

I need to avoid the Access Violation error and still prevent memory leaks.  Please help.


Below is a partial copy of the stack at the point at which the leaks appear:

_heap_alloc_dbg(unsigned int 28, int 1, const char * 0x00000000, int 0) line 338
_nh_malloc_dbg(unsigned int 28, int 1, int 1, const char * 0x00000000, int 0) line 248 + 21 bytes
_nh_malloc(unsigned int 28, int 1) line 197 + 19 bytes
operator new(unsigned int 28) line 24 + 11 bytes
std::_Allocate(int 28, char * 0x00000000) line 30 + 9 bytes
std::allocator<std::pair<unsigned int,std::vector<XalanSourceTreeAttr *,std::allocator<XalanSourceTreeAttr *> > > >::_Charalloc(unsigned int 28) line 62 + 11 bytes

std::list<std::pair<unsigned int,std::vector<XalanSourceTreeAttr *,std::allocator<XalanSourceTreeAttr *> > >,std::allocator<std::pair<unsigned int,std::vector<XalanSourceTreeAttr *,std::allocator<XalanSourceTreeAttr *> > > > >::_Buynode(...) line 387 + 10 bytes

std::list<std::pair<unsigned int,std::vector<XalanSourceTreeAttr *,std::allocator<XalanSourceTreeAttr *> > >,std::allocator<std::pair<unsigned int,std::vector<XalanSourceTreeAttr *,std::allocator<XalanSourceTreeAttr *> > > > >::insert(...) line 219 + 27 bytes

std::list<std::pair<unsigned int,std::vector<XalanSourceTreeAttr *,std::allocator<XalanSourceTreeAttr *> > >,std::allocator<std::pair<unsigned int,std::vector<XalanSourceTreeAttr *,std::allocator<XalanSourceTreeAttr *> > > > >::push_back(const std::pair<unsigned int,std::vector<XalanSourceTreeAttr *,std::allocator<XalanSourceTreeAttr *> > > & {...}) line 208 + 61 bytes

XalanSourceTreeAttributesVector::createEntry(unsigned int 500, unsigned int 2) line 125 + 76 bytes
XalanSourceTreeAttributesVector::allocate(unsigned int 2) line 97 + 19 bytes
XalanSourceTreeDocument::createElementNode(const unsigned short * 0x00a97140, const Attributes & {...}, XalanNode * 0x00000000, XalanNode * 0x00000000, XalanNode * 0x00000000, unsigned char 1) line 911 + 33 bytes

XalanSourceTreeContentHandler::createElement(const unsigned short * const 0x00a550d8, const unsigned short * const 0x00a970b0, const unsigned short * const 0x00a97140, const Attributes & {...}, XalanSourceTreeElement * 0x00000000) line 513

XalanSourceTreeContentHandler::startElement(const unsigned short * const 0x00a550d8, const unsigned short * const 0x00a970b0, const unsigned short * const 0x00a97140, const Attributes & {...}) line 330 + 31 bytes

SAX2XMLReaderImpl::startElement(const XMLElementDecl & {...}, const unsigned int 1, const unsigned short * const 0x00a4b6d0, const


_heap_alloc_dbg(unsigned int 24, int 1, const char * 0x00000000, int 0) line 338
_nh_malloc_dbg(unsigned int 24, int 1, int 1, const char * 0x00000000, int 0) line 248 + 21 bytes
_nh_malloc(unsigned int 24, int 1) line 197 + 19 bytes
operator new(unsigned int 24) line 24 + 11 bytes
ArenaAllocator<XalanDOMString,ArenaBlock<XalanDOMString> >::allocateBlock() line 168 + 7 bytes
XalanDOMStringPool::get(const unsigned short * 0x00a4d7a0, unsigned int 19) line 142 + 17 bytes
XalanSourceTreeDocument::createCommentNode(const unsigned short * 0x00a4d7a0, unsigned int 19, XalanNode * 0x00000000, XalanNode * 0x00000000, XalanNode * 0x00000000) line 950 + 63 bytes

XalanSourceTreeContentHandler::comment(const unsigned short * const 0x00a4d7a0, const unsigned int 19) line 417 + 30 bytes

SAX2XMLReaderImpl::docComment(const unsigned short * const 0x00a4d7a0) line 759
XMLScanner::scanComment() line 2691
XMLScanner::scanProlog() line 2193
XMLScanner::scanDocument(const InputSource & {...}, const unsigned char 0) line 422
SAX2XMLReaderImpl::parse(const InputSource & {...}) line 607
XalanSourceTreeParserLiaison::parseXMLStream(const InputSource &, const XalanDOMString & {...}) line 250 + 37 bytes
CXMLDataSource::InitXPath() line 1732 + 71 bytes

Reply via email to