[geos-commits] r2114 - in trunk/source: geom/prep
headers/geos/geom/prep headers/geos/noding noding
svn_geos at osgeo.org
svn_geos at osgeo.org
Tue Jan 29 12:55:09 EST 2008
Author: benjubb
Date: 2008-01-29 12:55:09 -0500 (Tue, 29 Jan 2008)
New Revision: 2114
Modified:
trunk/source/geom/prep/AbstractPreparedPolygonContains.cpp
trunk/source/geom/prep/PreparedLineString.cpp
trunk/source/geom/prep/PreparedPolygon.cpp
trunk/source/headers/geos/geom/prep/PreparedLineString.h
trunk/source/headers/geos/noding/SegmentIntersectionDetector.h
trunk/source/headers/geos/noding/SegmentIntersector.h
trunk/source/noding/MCIndexSegmentSetMutualIntersector.cpp
trunk/source/noding/SegmentIntersectionDetector.cpp
Log:
Some small changes to improve the memory management. These changes plug a few leaks, but not all.
Modified: trunk/source/geom/prep/AbstractPreparedPolygonContains.cpp
===================================================================
--- trunk/source/geom/prep/AbstractPreparedPolygonContains.cpp 2008-01-29 17:49:18 UTC (rev 2113)
+++ trunk/source/geom/prep/AbstractPreparedPolygonContains.cpp 2008-01-29 17:55:09 UTC (rev 2114)
@@ -92,7 +92,10 @@
delete intDetector;
delete li;
for ( size_t i = 0, ni = lineSegStr.size(); i < ni; i++ )
+ {
+ delete lineSegStr[ i ]->getCoordinates();
delete lineSegStr[ i ];
+ }
}
Modified: trunk/source/geom/prep/PreparedLineString.cpp
===================================================================
--- trunk/source/geom/prep/PreparedLineString.cpp 2008-01-29 17:49:18 UTC (rev 2113)
+++ trunk/source/geom/prep/PreparedLineString.cpp 2008-01-29 17:55:09 UTC (rev 2114)
@@ -32,12 +32,12 @@
{
if (! segIntFinder)
{
- noding::SegmentString::ConstVect ss;
- noding::SegmentStringUtil::extractSegmentStrings( &getGeometry(), ss );
- segIntFinder = new noding::FastSegmentSetIntersectionFinder( &ss );
+ //noding::SegmentString::ConstVect ss;
+ noding::SegmentStringUtil::extractSegmentStrings( &getGeometry(), segStrings );
+ segIntFinder = new noding::FastSegmentSetIntersectionFinder( &segStrings );
- for ( size_t i = 0, ni = ss.size(); i < ni; i++ )
- delete ss[ i ];
+ //for ( size_t i = 0, ni = ss.size(); i < ni; i++ )
+ // delete ss[ i ];
}
return segIntFinder;
Modified: trunk/source/geom/prep/PreparedPolygon.cpp
===================================================================
--- trunk/source/geom/prep/PreparedPolygon.cpp 2008-01-29 17:49:18 UTC (rev 2113)
+++ trunk/source/geom/prep/PreparedPolygon.cpp 2008-01-29 17:55:09 UTC (rev 2114)
@@ -53,7 +53,10 @@
delete ptOnGeomLoc;
for ( size_t i = 0, ni = segStrings.size(); i < ni; i++ )
+ {
+ delete segStrings[ i ]->getCoordinates();
delete segStrings[ i ];
+ }
}
Modified: trunk/source/headers/geos/geom/prep/PreparedLineString.h
===================================================================
--- trunk/source/headers/geos/geom/prep/PreparedLineString.h 2008-01-29 17:49:18 UTC (rev 2113)
+++ trunk/source/headers/geos/geom/prep/PreparedLineString.h 2008-01-29 17:55:09 UTC (rev 2114)
@@ -18,6 +18,7 @@
#define GEOS_GEOM_PREP_PREPAREDLINESTRING_H
#include <geos/geom/prep/BasicPreparedGeometry.h> // for inheritance
+#include <geos/noding/SegmentString.h>
namespace geos {
namespace noding {
@@ -39,6 +40,7 @@
{
private:
noding::FastSegmentSetIntersectionFinder * segIntFinder;
+ mutable noding::SegmentString::ConstVect segStrings;
protected:
public:
@@ -63,3 +65,4 @@
* $Log$
**********************************************************************/
+
Modified: trunk/source/headers/geos/noding/SegmentIntersectionDetector.h
===================================================================
--- trunk/source/headers/geos/noding/SegmentIntersectionDetector.h 2008-01-29 17:49:18 UTC (rev 2113)
+++ trunk/source/headers/geos/noding/SegmentIntersectionDetector.h 2008-01-29 17:55:09 UTC (rev 2114)
@@ -57,6 +57,13 @@
intSegments( NULL)
{ }
+ ~SegmentIntersectionDetector()
+ {
+ //delete intPt;
+ delete intSegments;
+ }
+
+
void setFindProper( bool findProper)
{
this->findProper = findProper;
@@ -154,3 +161,4 @@
* $Log$
**********************************************************************/
+
Modified: trunk/source/headers/geos/noding/SegmentIntersector.h
===================================================================
--- trunk/source/headers/geos/noding/SegmentIntersector.h 2008-01-29 17:49:18 UTC (rev 2113)
+++ trunk/source/headers/geos/noding/SegmentIntersector.h 2008-01-29 17:55:09 UTC (rev 2114)
@@ -70,10 +70,12 @@
return false;
}
+ virtual ~SegmentIntersector()
+ { }
+
protected:
SegmentIntersector() {}
- virtual ~SegmentIntersector() {}
};
@@ -99,3 +101,4 @@
*
**********************************************************************/
+
Modified: trunk/source/noding/MCIndexSegmentSetMutualIntersector.cpp
===================================================================
--- trunk/source/noding/MCIndexSegmentSetMutualIntersector.cpp 2008-01-29 17:49:18 UTC (rev 2113)
+++ trunk/source/noding/MCIndexSegmentSetMutualIntersector.cpp 2008-01-29 17:55:09 UTC (rev 2114)
@@ -45,9 +45,11 @@
index->insert(mc->getEnvelope(), mc);
}
+// BWJ - seems to cause some tests of prepared predicates to fail, but leaving this out probably causes a
+// memory leak. more research needed
// for ( std::vector<MonotoneChain *>::iterator i = segChains->begin(), e = segChains->end(); i != e; i++ )
// delete *i;
- delete segChains;
+// delete segChains;
}
void
Modified: trunk/source/noding/SegmentIntersectionDetector.cpp
===================================================================
--- trunk/source/noding/SegmentIntersectionDetector.cpp 2008-01-29 17:49:18 UTC (rev 2113)
+++ trunk/source/noding/SegmentIntersectionDetector.cpp 2008-01-29 17:55:09 UTC (rev 2114)
@@ -25,8 +25,11 @@
namespace geos {
namespace noding { // geos::noding
+
+
void
-SegmentIntersectionDetector::processIntersections(
+SegmentIntersectionDetector::
+processIntersections(
noding::SegmentString * e0, int segIndex0,
noding::SegmentString * e1, int segIndex1 )
{
@@ -65,6 +68,8 @@
// record intersection location (approximate)
intPt = &li->getIntersection(0);
+ delete intSegments;
+
// record intersecting segments
intSegments = new geom::CoordinateArraySequence();
intSegments->add( p00, true);
More information about the geos-commits
mailing list