[postgis-commits] svn - r2993 - trunk/lwgeom
postgis-commits at postgis.refractions.net
postgis-commits at postgis.refractions.net
Tue Sep 23 12:07:03 PDT 2008
Author: pramsey
Date: 2008-09-23 12:07:03 -0700 (Tue, 23 Sep 2008)
New Revision: 2993
Modified:
trunk/lwgeom/lwgeom_rtree.c
Log:
Reduce p-i-p memory leak by 50%
Modified: trunk/lwgeom/lwgeom_rtree.c
===================================================================
--- trunk/lwgeom/lwgeom_rtree.c 2008-09-23 13:05:23 UTC (rev 2992)
+++ trunk/lwgeom/lwgeom_rtree.c 2008-09-23 19:07:03 UTC (rev 2993)
@@ -422,7 +422,11 @@
if(lwgeom_size_poly(currentCache->poly) != length)
{
LWDEBUG(3, "Polygon size mismatch, creating new cache.");
-
+ for(i = 0; i < currentCache->ringCount; i++)
+ {
+ freeTree(currentCache->ringIndices[i]);
+ }
+ lwfree(currentCache->ringIndices);
lwfree(currentCache->poly);
lwfree(currentCache);
return createNewCache(poly, serializedPoly);
@@ -435,6 +439,11 @@
{
LWDEBUGF(3, "Polygon mismatch, creating new cache. %c, %c", a, b);
+ for(i = 0; i < currentCache->ringCount; i++)
+ {
+ freeTree(currentCache->ringIndices[i]);
+ }
+ lwfree(currentCache->ringIndices);
lwfree(currentCache->poly);
lwfree(currentCache);
return createNewCache(poly, serializedPoly);
More information about the postgis-commits
mailing list