[geos-devel] [GEOS] #294: reserving to much memory inPolygon::GetCoordinates

GEOS geos-trac at osgeo.org
Thu Oct 15 06:08:15 EDT 2009


#294: reserving to much memory inPolygon::GetCoordinates
------------------------+---------------------------------------------------
 Reporter:  jaapdekker  |       Owner:  geos-devel at lists.osgeo.org
     Type:  defect      |      Status:  new                       
 Priority:  major       |   Milestone:                            
Component:  Default     |     Version:  3.0.3                     
 Severity:  Unassigned  |    Keywords:                            
------------------------+---------------------------------------------------
 A length error exception is thrown when Polygon.GetCoordinates() is called
 with a polygon(sea area around Scotland) with 1396535 coordinates where
 the shell has size 411057 and that contains 7998 holes (Islands in the
 sea) the error is caused in Polygon.cpp where a reserve is done with the
 wrong size
 the error is on line 123 in Polygon.cpp
         npts=shellCoords->getSize();

         /*
          * reserve space in the vector as if all holes have the same
          * amount of points. Holes usually have less, so this should
          * be a good compromise
          */
         cl->reserve((nholes+1)*npts);

 causing 3,287,633,886 Coordinates to be allocated

-- 
Ticket URL: <http://trac.osgeo.org/geos/ticket/294>
GEOS <http://geos.refractions.net/>
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite (JTS).


More information about the geos-devel mailing list