[postgis-devel] [geos-devel] initGEOS semantic ?

strk strk at keybit.net
Sat Apr 17 08:40:54 PDT 2010


As of GEOS r2974 initGEOS works back as it did in 3.0.0,
that is it will not allocate new memory.

To give you a figure, calling 'SELECT ST_IsValid(geom) from myTable;'
where myTable contains 120044 geometries resulted in +4Mb of memory
leaking:

  definitely lost: 4,801,698 bytes in 120,040 blocks.

With the new commit that figure goes down to a constant 298 bytes.
Might be worth a 3.2.2...

--strk;

On Sat, Apr 17, 2010 at 02:14:59PM +0200, strk wrote:
> For the record, I verified that up to 3.0.0
> the semantic was indeed NOT to allocate any new
> structures, see:
> 
>  http://trac.osgeo.org/geos/browser/branches/3.0/capi/geos_c.cpp
> 
> Thus I think we should go back there.
> 
> --strk;
> 
> 
> On Sat, Apr 17, 2010 at 01:22:22PM +0200, strk wrote:
> > I tought initGEOS() [ the non-rehentrant version ]
> > was always returning the same handle, a singleton.
> > 
> > Code reveals that's not the case, which means
> > old clients (like postgis) end up allocating
> > lots of contexts and leat them leak.
> > 
> > So, is there any reason not to return a singleton ?



More information about the postgis-devel mailing list