At 14.24 22/06/2006 +0100, Sousa, Rafael \(ext\) wrote:
Hi Alberto!Well... The memory leak is not necessarly in Xerces code. Can be in the way I'm using the API. So far, I've reduced it, just by deleting some objects that were returned by XMLString::transcode(). So, I have one question: I'm implementing the interface InputSource* SAXHandler::resolveEntity(XMLResourceIdentifier*); for XML Schema validation. On the example code I was based, it returns: return new LocalFileInputSource(XMLString::transcode("/path/to/schema/file")); Is there another way of returning from this function, without making the "new"? Can I be sure that this allocated object is properly disposed by Xerces?
That's the correct way: the resolveEntity must allocate the InputSource object on the heap, and Xerces will make sure to delete it. You may want to use a leak-finder tool (e.g. Valgrind) to find out where the leaks are.
Alberto
Thanks for your help! Rafael -----Original Message----- From: Alberto Massari [mailto:[EMAIL PROTECTED] Sent: quinta-feira, 22 de Junho de 2006 10:35 To: [email protected] Subject: Re: Memory leaks in Xerces-C++ Hi Rafael, At 19.53 21/06/2006 +0100, Sousa, Rafael \(ext\) wrote: >Hi all! > >Have any memory leaks been detected and corrected in libxerces-c lately? > >I've been using a compilation I did for Solaris last November 2005, and >now I'm suspecting that I may have memory leaks in it. > >On your site, I can see that Xerces is still in version 2.7.0. Has it >not suffered any changes since? There have been several fixes to the 2.7 branch, but we have not released another version since then; however, I don't recall any fix for memory leaks. Can you find out if and when the leak occurs? Thanks, Alberto
