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

Paul Ramsey pramsey at cleverelephant.ca
Sat Apr 17 13:46:51 EDT 2010


Yes, indeed. This could also be the source of a leak reported a couple
weeks ago in the otherwise boring centroid function...

P

On Sat, Apr 17, 2010 at 8:40 AM, strk <strk at keybit.net> wrote:
> 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 ?
> _______________________________________________
> geos-devel mailing list
> geos-devel at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geos-devel
>


More information about the geos-devel mailing list