Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1309 from tst-lsavoie/issue-1308-xml-purge-default
Browse files Browse the repository at this point in the history
Issue 1308: Purge XML by default
  • Loading branch information
tst-rwildes committed May 17, 2019
2 parents 7b2bee3 + 922b0af commit c8cef00
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 29 deletions.
8 changes: 2 additions & 6 deletions docs/geedocs/5.3.0/answer/176738.html
Original file line number Diff line number Diff line change
Expand Up @@ -280,16 +280,12 @@ <h2 id="cache_configuration">Cache configuration</h2>
BLOCK_SIZE=&lt;value&gt;
<br><br>
# whether or not to purge the XML cache; valid values are 0 or 1<br>
# default is 0<br>
PURGE=0
# default is 1<br>
PURGE=1
<br><br>
# the level at which to purge the XML cache; can be 1 (most often) to 5 (least often)<br>
# default is 3<br>
PURGE_LEVEL=3
<br><br>
# deallocate all memory allocated by Xerces when the Xerces cache is purged; valid values are 0 or 1<br>
# default is 0<br>
DEALLOCATE_ALL=0
</code>
<h2 id="status_request_timeout">Status request timeout</h2>
<p>Status requests to the system manager from clients like <code>getop</code> must wait to be fulfilled if the system manager
Expand Down
25 changes: 4 additions & 21 deletions earth_enterprise/src/common/khxml/khxml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ XMLSize_t GEXMLObject::maxDOMSubAllocationSize;
bool GEXMLObject::doPurge;
int GEXMLObject::purgeLevel;
XMLSize_t GEXMLObject::purgeThreshold;
bool GEXMLObject::deallocateAll;
bool GEXMLObject::xercesInitialized = false;

uint32_t GEXMLObject::activeObjects = 0;
Expand Down Expand Up @@ -136,12 +135,6 @@ class SimpleMemoryManager : public MemoryManager {
allocated.clear();
allocatedSize = 0;
}
// Clear storage without deallocating anything
void clear() {
khLockGuard guard(mutex);
allocated.clear();
allocatedSize = 0;
}
};

static SimpleMemoryManager memoryManager;
Expand Down Expand Up @@ -177,8 +170,7 @@ void GEXMLObject::setDefaultValues()
maxDOMHeapAllocSize = 0x20000;
maxDOMSubAllocationSize = 0x1000;
purgeLevel = 3;
doPurge = false;
deallocateAll = false;
doPurge = true;
}

void GEXMLObject::initializeXMLParameters() {
Expand Down Expand Up @@ -213,8 +205,6 @@ void GEXMLObject::initializeXMLParametersFromStream(std::istream & input) {
maxDOMSubAllocationSize = std::stol(it.second);
else if (it.first == PURGE)
doPurge = (std::stol(it.second) == 1);
else if (it.first == DEALLOCATE_ALL)
deallocateAll = (std::stol(it.second) == 1);
else if (it.first == PURGE_LEVEL)
{
purgeLevel = std::stol(it.second);
Expand Down Expand Up @@ -270,15 +260,13 @@ GEXMLObject::GEXMLObject() {
"maxDOMSubAllocationSize=%zu\n"
"doPurge=%s\n"
"purgeLevel=%d\n"
"purgeThreshold=%zu\n"
"deallocateAll=%s",
"purgeThreshold=%zu",
initialDOMHeapAllocSize,
maxDOMHeapAllocSize,
maxDOMSubAllocationSize,
(doPurge ? "true" : "false"),
purgeLevel,
purgeThreshold,
(deallocateAll ? "true" : "false"));
purgeThreshold);
}
catch (const XMLException& toCatch)
{
Expand All @@ -297,12 +285,7 @@ GEXMLObject::~GEXMLObject() {
try {
XMLPlatformUtils::Terminate();
xercesInitialized = false;
if (deallocateAll) {
memoryManager.deallocateAll();
}
else {
memoryManager.clear();
}
memoryManager.deallocateAll();
notify(NFY_DEBUG, "Terminated XML library");
} catch(const XMLException& toCatch) {
notify(NFY_WARN, "Unable to terminate Xerces: %s",
Expand Down
5 changes: 3 additions & 2 deletions earth_enterprise/src/common/khxml/khxml.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ class GEXMLObject {
const static std::string BLOCK_SIZE;
const static std::string PURGE;
const static std::string PURGE_LEVEL;
// The DEALLOCATE_ALL option does nothing now, but it is still accepted for
// backwards compatibility.
const static std::string DEALLOCATE_ALL;
const static std::string XMLConfigFile;
const static std::array<std::string,6> options;
Expand All @@ -143,7 +145,6 @@ class GEXMLObject {
static bool doPurge;
static int purgeLevel;
static XMLSize_t purgeThreshold;
static bool deallocateAll;
static bool xercesInitialized;

static uint32_t activeObjects;
Expand Down Expand Up @@ -192,4 +193,4 @@ class GEParsedDocument : public GEDocument {
~GEParsedDocument();
};

#endif /* __KHXML_H */
#endif /* __KHXML_H */

0 comments on commit c8cef00

Please sign in to comment.