[xsd-users] Returning data by criteria

Boris Kolpackov boris at codesynthesis.com
Mon Feb 22 09:45:40 EST 2010


Hi Bidski,

Bidski <bidski at bigpond.net.au> writes:

> Hi Boris,
>
> What I was missing in the code to pre-load the schema file was a call to  
> ::xercesc::XMLPlatformUtils::Initialize();. Apparently this is needed for 
> the calls to SAX2XMLReader.

Yes, also don't forget to call xercesc::XMLPlatformUtils::Terminate();
at the end of your main().


> The problem I have now are memory leaks. Looks to be as though I have 1 
> memory leak for each for schema/xml file. Can you point me in the 
> direction of any specific clean-up calls that I need to make to the 
> xerces library? I found that I was getting a fairly substantial memory 
> leak from the SAX2XMLReader which was resolved with a call to 
> ~SAX2XMLReader();, but I am at a loss to what is causing these other 
> memory leaks and Visual Studio is not giving me much to go on. Following 
> is an example of one of the memory leaks I am getting.
>
> Detected memory leaks!
> Dumping objects ->
> {7541} normal block at 0x00727CA0, 148 bytes long.
> Data: <H k      z   ~  > 48 DC 6B 00 CD CD CD CD 84 7A 1E 12 90 7E 1E 12
>
> Any thoughts?

It is hard to say specifically what might be the cause since this dump
is not very helpful. I suggest that you try one of the following:

1. Get a proper memory profiling tool. I am not sure what would be a
   good choice for Windows. On Linux/UNIX, valgrind works very well.

2. Try to model your code after the 'performance' example. This example
   does pretty much the same thing as your application when it comes
   to XML parsing and, as far as I know, doesn't have any memory leaks 
   (you can actually double-check this and if you see a leak there too
   then the problem must be Windows-specific and is probably in Xerces-C++).

Boris



More information about the xsd-users mailing list