[postgis-devel] lwgeom_release WTF

strk strk at keybit.net
Fri Sep 26 11:18:28 PDT 2008


On Fri, Sep 26, 2008 at 05:44:49PM +0100, Mark Cave-Ayland wrote:
> strk wrote:
> 
> >Right. This is basically a memory optimization as most of the times
> >(when under postgres umbrella) the actual BIG THINGS are kept serialized
> >in the detoasted datum, so would get released by postgres pools.
> >
> >The plan for release_deep/clone_deep was for extra-postgres use
> >(standalone liblwgeom).
> 
> I see. So you're saying that the POINTARRAYs are effectively pointers 
> into the serialized set of points within the Datum?

Exactly. And each component geometry in a collection stores a pointer
inside that single big block.

> This would explain 
> why the PIP code leaks so much, since normally any geometries returned 
> as a SELECT function will be freed automatically when the executor has 
> finished with them. The PIP code however, generates its structures 
> internally and so must responsible for clearing them itself.

Right, everytime a POINTARRAY is explicitly allocated, it must be
explicitly released, and that's what the _deep functions would be
for. 

--strk;



More information about the postgis-devel mailing list