Hi,
I'm implementing a program which reads and parses an XML file when
starts and then I would need to read same XML file again cyclicly to load the
same file again to load any possible change.
Summarily what I'm doing is this based on this example
<http://www.yolinux.com/TUTORIALS/XML-Xerces-C.html> (I skipped all error
handling, etc):
.....
this->xmlParser = new XercesDOMParser();
this->xmlErrHandler = (ErrorHandler*) new HandlerBase();
this->xmlParser->setErrorHandler(this->xmlErrHandler);
this->xmlParser->setValidationScheme(XercesDOMParser::Val_Auto);
this->xmlParser->setDoNamespaces(true);
this->xmlParser->setDoSchema(false);
* this->xmlParser->resetDocument();*
* this->xmlParser->parse(fileName);**
** xmlDoc = xmlParser->getDocument();*
.... read XML sections here
if I repeat the part in bold cyclicly I'm able to re-load the xml file
successfully but I get a memory leak. Memory keeps increasing on each cycle.
I had even tried to completely destroy the xml objects like this;
this->xmlParser->reset();
delete this->xmlParser;
delete this->xmlErrHandler;
this->xmlParser = NULL;
this->xmlErrHandler = NULL;
and intialize them again but still have a leak
So my question is how can I cyclicly read an xml file without having a
memory increase on every read and without having to almost destroy all objects
and recreate tham back again ?
Thanks,
Adelino.