<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.28.3">
</HEAD>
<BODY>
<BR>
<BLOCKQUOTE TYPE=CITE>
<PRE>
Right. I discovered this leak when I was testing the new pgsql2shp code
in trunk, and the short version is that there is an incredibly naive
piece of coding in the existing parser alloc_tuple() that throws away
malloc() linked lists in certain circumstances.
I did try and come up with a workaround by tracking lists of lists, but
that then caused other errors to appear all through the parser. Since it
was something that could not be fixed without substantial work, I came
to the conclusion that we're much better off going with Paul's new
version and investing the time/effort there instead. So I can't see this
ever getting fixed in the current parser I'm afraid :(
ATB,
Mark.
</PRE>
</BLOCKQUOTE>
<BR>
<BR>
I realize that this was more scary than imagined. <BR>
<BR>
BTW, when I chased away the serialized form from measures.c I did :<BR>
geom1 = <A HREF="http://postgis.refractions.net/documentation/postgis-doxygen/da/de7/liblwgeom_8h_e9baf85b25456ffa7483da2054f511f6.html#e9baf85b25456ffa7483da2054f511f6">lwgeom_deserialize</A>(<A HREF="http://postgis.refractions.net/documentation/postgis-doxygen/d4/da1/lwgeom__pg_8h_ff8f086b7f47cfafde329139a9c09407.html#ff8f086b7f47cfafde329139a9c09407">SERIALIZED_FORM</A>((<A HREF="http://postgis.refractions.net/documentation/postgis-doxygen/df/d27/structPG__LWGEOM.html">PG_LWGEOM</A> *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0))));<BR>
<BR>
I saw now that most other functions do:<BR>
<BR>
<A HREF="http://postgis.refractions.net/documentation/postgis-doxygen/df/d27/structPG__LWGEOM.html">PG_LWGEOM</A> *geom = (<A HREF="http://postgis.refractions.net/documentation/postgis-doxygen/df/d27/structPG__LWGEOM.html">PG_LWGEOM</A> *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));<BR>
PG_FREE_IF_COPY(geom, 0);<BR>
<BR>
<BR>
When are they copied and should get freed. Is that the same thing but on the serialized form that Paul discussed that it depends if the geoemtry comes from the database or from text represention?<BR>
<BR>
When I don't use :<BR>
PG_FREE_IF_COPY(geom, 0);<BR>
<BR>
will that give a more severe leak since it is postgres stuff?<BR>
<BR>
/Nicklas
</BODY>
</HTML>