This discussion is archived
2 Replies Latest reply: Aug 22, 2012 3:59 AM by 955652 RSS

Memory is not reclaimed after deleting element through deleteDocument

955652 Newbie
Currently Being Moderated
Hi,
I am using xmldb 2.3.10 in a large setup. Periodically db versions are created. While trying to purge the versions I am not able to see the memory usage going down until I restart the app. But after purging the versions and then restarting the app I can see huge memory gain. Can you please suggest ways to handle the same without restart.

Here is what I am doing:

Input : XmlTransaction& txn and integer type lastVersionToPurge
)
/*Code for xquery*/
string xquery;
xquery.append(" for $i in collection('").append(getName()).append("')");
xquery.append(" where $i/dbxml:metadata('").append(XdbConstants::METADATA_HIGH_DBVERID)
.append("')<=").append(Utils::uintToStr(lastVersionToPurge));
xquery.append(" return $i");

XmlQueryContext qc = getXmlManager().createQueryContext();
qc.setEvaluationType(XmlQueryContext::Lazy);
XmlResults res = getXmlManager().query(txn, xquery, qc, DBXML_LAZY_DOCS);
XmlDocument doc;
while (res.next(doc)) {
string docId = doc.getName();
//Setting up a boolean flag for metadat and ...
XmlUpdateContext uc = getXmlManager().createUpdateContext();
container_->deleteDocument(txn, docId, uc);

Now issue is that the process containing xmldb is approx 1GB before purging these versions. If without purging these version I restart the process there is not significant reduction in memory usage but if I restart the process after purge I can see huge reduction in memory footprint of containing process. Since restart of containing process includes stop/start of dbxml, is it possible to only restart the xmldb after the purge? If so what are the api's. If no are there other alternatives that do not require a restart of containing process.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points