[xsd-users] Tree FAQ memory management question

Boris Kolpackov boris at codesynthesis.com
Thu May 24 12:23:41 EDT 2018


Iain Sharp <isharp at atis.org> writes:

>   xml::dom::auto_ptr<DOMDocument> doc (
>     impl->createDocument (
>       (ns.empty () ? 0 : xml::string (ns).c_str ()),
>       xml::string ((prefix.empty () ? name : prefix + ':' + name)).c_str (),
>       0));
> 
> 
> I can't unpick how the smart pointer behaviour is interacting with
> the XERCESC memory management in this example. When the "doc" goes
> out of scope, will the doc->release() method be called to free any
> dependent resources before the doc object is destroyed?

Yes, release() is called (which deletes the DOMDocument object).

Boris



More information about the xsd-users mailing list