You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by "EXT-Pennington, Dale K" <da...@boeing.com> on 2007/09/26 22:01:23 UTC

Parser -> release leads to crash

OK, I am a bit confused.

At program startup and I createing a DOM Builder object and storing it
to be used to parse a particular schema. At the end of the run I delete
it.

In between when I get a message I do the following :

DOMDocument *document = parser -> parse(input);

// Extract what I need from the document

parser -> release();

Now I have a successful parse, but at the end of the run, my program
core dumps on the delete parser line. If I comment out the parser ->
release, it does not crash.

My understanding is I want to call parser -> release to free up the
memory used by the document as soon as possible. Is my understanding
flawed ? Any idea why I might be crashing.

Thanks
Dale Pennington


Re: Parser -> release leads to crash

Posted by Boris Kolpackov <bo...@codesynthesis.com>.
EXT-Pennington, Dale K <da...@boeing.com> writes:

> My understanding is I want to call parser -> release to free up the
> memory used by the document as soon as possible.

By default the document is owned by the parser and is released when
the parser is destroyed. If you want to release the document yourself,
you need to set the UserAdoptsDOMDocument property:

parser->setFeature (XMLUni::fgXercesUserAdoptsDOMDocument, true);

Boris

-- 
Boris Kolpackov
Code Synthesis Tools CC
http://www.codesynthesis.com
Open-Source, Cross-Platform C++ XML Data Binding