diff --git a/geom/geos/geos.go b/geom/geos/geos.go index fd9139a..4e8aa3d 100644 --- a/geom/geos/geos.go +++ b/geom/geos/geos.go @@ -160,7 +160,6 @@ func (this *Geos) BoundsPolygon(bounds Bounds) *Geom { // geom inherited by Polygon, no destroy geom = this.Polygon(geom, nil) - this.DestroyLater(geom) return geom } diff --git a/geom/limit/limit.go b/geom/limit/limit.go index c4b373c..316d643 100644 --- a/geom/limit/limit.go +++ b/geom/limit/limit.go @@ -88,6 +88,7 @@ func SplitPolygonAtGrid(g *geos.Geos, geom *geos.Geom, gridWidth, currentGridWid return nil, errors.New("couldn't create bounds polygon") } part := g.Intersection(geom, clipGeom) + g.Destroy(clipGeom) if part == nil { return nil, errors.New("couldn't create intersection") } @@ -96,6 +97,7 @@ func SplitPolygonAtGrid(g *geos.Geos, geom *geos.Geom, gridWidth, currentGridWid result = append(result, part) } else { moreParts, err := SplitPolygonAtGrid(g, part, gridWidth, currentGridWidth/2.0) + g.Destroy(part) if err != nil { return nil, err }