Skip to content

v0.2.54..v0.2.55 changeset PoiPolygonMatchVisitor.cpp

Garret Voltz edited this page Aug 14, 2020 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/visitors/poi-polygon/PoiPolygonMatchVisitor.cpp b/hoot-core/src/main/cpp/hoot/core/visitors/poi-polygon/PoiPolygonMatchVisitor.cpp
index 5f5af3f..e941e98 100644
--- a/hoot-core/src/main/cpp/hoot/core/visitors/poi-polygon/PoiPolygonMatchVisitor.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/visitors/poi-polygon/PoiPolygonMatchVisitor.cpp
@@ -36,6 +36,7 @@
 #include <hoot/core/util/Log.h>
 #include <hoot/core/visitors/SpatialIndexer.h>
 #include <hoot/core/util/StringUtils.h>
+#include <hoot/core/util/MemoryUsageChecker.h>
 
 // tgs
 #include <tgs/RStarTree/MemoryPageStore.h>
@@ -78,6 +79,7 @@ _infoCache(infoCache)
   ConfigOptions opts = ConfigOptions();
   _reviewDistanceThreshold = opts.getPoiPolygonAdditionalSearchDistance();
   _taskStatusUpdateInterval = opts.getTaskStatusUpdateInterval();
+  _memoryCheckUpdateInterval = opts.getMemoryUsageCheckerInterval();
   LOG_VART(_infoCache.get());
   _timer.start();
 }
@@ -197,7 +199,7 @@ void PoiPolygonMatchVisitor::visit(const ConstElementPtr& e)
       PROGRESS_DEBUG(
         "Processed " << StringUtils::formatLargeNumber(_numMatchCandidatesVisited) <<
         " match candidates / " << StringUtils::formatLargeNumber(_map->getNodeCount()) <<
-        " total nodes.");
+        " nodes.");
     }
   }
 
@@ -220,6 +222,10 @@ void PoiPolygonMatchVisitor::visit(const ConstElementPtr& e)
       StringUtils::formatLargeNumber(_map->getNodeCount()) << " nodes.");
     _timer.restart();
   }
+  if (_numElementsVisited % _memoryCheckUpdateInterval == 0)
+  {
+    MemoryUsageChecker::getInstance().check();
+  }
 }
 
 bool PoiPolygonMatchVisitor::isMatchCandidate(ConstElementPtr element)
Clone this wiki locally