[postgis-devel] memory management questions #1

Paul Ramsey pramsey at opengeo.org
Mon Oct 25 14:15:22 PDT 2010


It doesn't even look  like we use PG_FREE_IF_COPY right:

http://doxygen.postgresql.org/fmgr_8h-source.html

>From my reading the correct usage would be:

PG_LWGEOM *geom = (PG_LWGEOM *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
PG_FREE_IF_COPY(geom, PG_GETARG_DATUM(0));

In any event, note that there are no leaks in this code in the larger
sense, because they are all happening in a statement context that is
thrown away by the overarching pgsql memory manager at the end of the
function call.

P.

On Mon, Oct 25, 2010 at 1:26 PM, Nicklas Avén
<nicklas.aven at jordogskog.no> wrote:

> I saw now that most other functions do:
>
> PG_LWGEOM *geom = (PG_LWGEOM *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
> PG_FREE_IF_COPY(geom, 0);



More information about the postgis-devel mailing list