summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-09-04 14:33:48 (GMT)
committerDennis Nienhüser <nienhueser@kde.org>2016-09-04 14:33:48 (GMT)
commit960680d0fe166cde05ae726effea7eccffb5c5a4 (patch)
tree3a14306cae302257877f682707876fe0a62beb23
parenta07275bdc68d185b14a952f31e7d104a2b0ee813 (diff)
Free memory early
Without this memory consumption raises continously and exceeds 32 GB already when working on level 7.
-rw-r--r--tools/vectorosm-tilecreator/BaseClipper.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/vectorosm-tilecreator/BaseClipper.cpp b/tools/vectorosm-tilecreator/BaseClipper.cpp
index 2a73570..b2e7747 100644
--- a/tools/vectorosm-tilecreator/BaseClipper.cpp
+++ b/tools/vectorosm-tilecreator/BaseClipper.cpp
@@ -28,6 +28,12 @@ public:
m_processed(false)
{}
+ void clear()
+ {
+ m_nextBasePolygonPoint.clear();
+ m_nextClipPolygonPoint.clear();
+ }
+
inline bool isEntering() const
{
return m_isEntering;
@@ -545,6 +551,15 @@ void BaseClipper::clipPolyObject ( const QPolygonF & polygon,
} else if(!clippedPolyObject.isEmpty()) {
clippedPolyObjects << clippedPolyObject;
}
+
+ // Break shared pointer deadlocks. Needed to free memory, without it no LinkedPoint instance would be deleted
+ typedef QVector<QSharedPointer<LinkedPoint>> Container;
+ auto containers = QVector<Container*>() << &clipPolygon << &basePolygon << &intersections;
+ foreach (auto const & container, containers) {
+ foreach (auto const & element, *container) {
+ element->clear();
+ }
+ }
}