You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by David Bonnecaze <DB...@Cornell-Mayo.com> on 2001/08/24 03:54:03 UTC

Xerces memory leak on Windows when deleting a parser --- Work aro und

Hello,

Found a solution to my memory leak problem.  Again, this is strange as well.
By setting the DOM_Document to 0 before deleting does the trick.

Code example:

int main(int argc, char* argv[])
{
  XMLPlatformUtils::Initialize();
  DOMParser* parser = new DOMParser;
  parser->setValidationScheme(DOMParser::Val_Auto); // validate if dtd
present
  parser->setIncludeIgnorableWhitespace(false) ;

  parser->parse("..\\dat\\persxml.dat") ;
  DOM_Document& theDoc = parser->getDocument() ;
  theDoc = 0 ;
  parser->reset() ;

  parser->parse("..\\dat\\persopts.xml",true) ;
  delete parser ;

  XMLPlatformUtils::Terminate();

  return 0 ;
  
}

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: Xerces memory leak on Windows when deleting a parser --- Work around

Posted by Alberto Massari <al...@exceloncorp.com>.
At 21.54 23/08/2001 -0400, you wrote:
>Hello,
>
>Found a solution to my memory leak problem.  Again, this is strange as well.
>By setting the DOM_Document to 0 before deleting does the trick.

Can you try using a plain DOM_Document instead of a DOM_Document&? I guess 
that reference counting could not be able to handle such a situation.

Alberto

-------------------------------
Alberto Massari
eXcelon Corp.
http://www.StylusStudio.com


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org