Skip to content

v0.2.54..v0.2.55 changeset BuildingMatchCreator.cpp

Garret Voltz edited this page Aug 14, 2020 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/conflate/polygon/BuildingMatchCreator.cpp b/hoot-core/src/main/cpp/hoot/core/conflate/polygon/BuildingMatchCreator.cpp
index 210b083..dfee9d8 100644
--- a/hoot-core/src/main/cpp/hoot/core/conflate/polygon/BuildingMatchCreator.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/conflate/polygon/BuildingMatchCreator.cpp
@@ -44,6 +44,7 @@
 #include <hoot/core/util/CollectionUtils.h>
 #include <hoot/core/algorithms/extractors/OverlapExtractor.h>
 #include <hoot/core/schema/OsmSchema.h>
+#include <hoot/core/util/MemoryUsageChecker.h>
 
 // Standard
 #include <fstream>
@@ -103,8 +104,10 @@ public:
     _maxGroupSize = 0;
     _numElementsVisited = 0;
     _numMatchCandidatesVisited = 0;
-    _taskStatusUpdateInterval = ConfigOptions().getTaskStatusUpdateInterval();
-    _searchRadius = ConfigOptions().getSearchRadiusBuilding();
+    ConfigOptions opts;
+    _taskStatusUpdateInterval = opts.getTaskStatusUpdateInterval();
+    _searchRadius = opts.getSearchRadiusBuilding();
+    _memoryCheckUpdateInterval = opts.getMemoryUsageCheckerInterval();
   }
 
   ~BuildingMatchVisitor()
@@ -216,8 +219,9 @@ public:
       {
         PROGRESS_DEBUG(
           "Processed " << StringUtils::formatLargeNumber(_numMatchCandidatesVisited) <<
-          " match candidates / " << StringUtils::formatLargeNumber(_map->getElementCount()) <<
-          " total elements.");
+          " match candidates / " <<
+          StringUtils::formatLargeNumber(_map->getWayCount() + _map->getRelationCount()) <<
+          " elements.");
       }
     }
 
@@ -226,7 +230,12 @@ public:
     {
       PROGRESS_INFO(
         "Processed " << StringUtils::formatLargeNumber(_numElementsVisited) << " / " <<
-        StringUtils::formatLargeNumber(_map->getElementCount()) << " elements.");
+        StringUtils::formatLargeNumber(_map->getWayCount() + _map->getRelationCount()) <<
+        " elements.");
+    }
+    if (_numElementsVisited % _memoryCheckUpdateInterval == 0)
+    {
+      MemoryUsageChecker::getInstance().check();
     }
   }
 
@@ -301,14 +310,15 @@ private:
   long _numElementsVisited;
   long _numMatchCandidatesVisited;
   int _taskStatusUpdateInterval;
+  int _memoryCheckUpdateInterval;
 
   void _markNonOneToOneMatchesAsReview(std::vector<MatchPtr>& matches)
   {      
     for (std::vector<MatchPtr>::iterator it = matches.begin(); it != matches.end(); ++it)
     {
       MatchPtr match = *it;
-      //Not proud of this, but not sure what else to do at this point w/o having to change the
-      //Match interface.
+      // Not proud of this, but not sure what else to do at this point w/o having to change the
+      // Match interface.
       MatchClassification& matchClass =
         const_cast<MatchClassification&>(match->getClassification());
       matchClass.setReview();
Clone this wiki locally