<!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>
Hallo<BR>
<BR>
I'm trying to learn some more and are studying the distance-functions through cunit and valgrind.<BR>
<BR>
My first question is:<BR>
<BR>
I think lwgeom_free and lwgeom_release seems to do much the same thing. <BR>
Why do we have both? When to use which one?<BR>
<BR>
and another small question:<BR>
<BR>
I found that the bbox was not released when calling lwgeom_free with points. For other types there is a check for bbox and they are freed but not for points in lwpoint_free.<BR>
<BR>
Is that for some reason or is it a bug?<BR>
<BR>
<BR>
<BR>
Then I have a third question that maybe wrong time to ask since Paul is working on the parser. But I get memory leaks when using lwgeom_from_ewkt looking like this:<BR>
<BR>
==32144== 37 bytes in 1 blocks are definitely lost in loss record 2 of 3<BR>
==32144==    at 0x4C274A8: malloc (vg_replace_malloc.c:236)<BR>
==32144==    by 0x42BB7F: make_serialized_lwgeom (lwgparse.c:1387)<BR>
==32144==    by 0x42CA2A: parse_it (lwgparse.c:1730)<BR>
==32144==    by 0x417253: serialized_lwgeom_from_ewkt (lwgeom.c:758)<BR>
==32144==    by 0x417DB3: lwgeom_from_ewkt (lwgeom.c:736)<BR>
==32144==    by 0x40A02F: test_mindistance2d_tolerance (cu_measures.c:35)<BR>
==32144==    by 0x50B32A9: ??? (in /usr/lib/libcunit.so.1.0.1)<BR>
==32144==    by 0x50B3ACE: CU_run_test (in /usr/lib/libcunit.so.1.0.1)<BR>
==32144==    by 0x411B6B: main (cu_tester.c:138)<BR>
<BR>
<BR>
and the test then looked like this:<BR>
<BR>
static void test_mindistance2d_tolerance(void)<BR>
{               <BR>
        LWGEOM *lw1;<BR>
        lw1 = lwgeom_from_ewkt("LINESTRING(0 0, 1 1)", PARSER_CHECK_NONE);<BR>
        lwgeom_free(lw1);<BR>
}<BR>
<BR>
<BR>
As I understand it we never free *<A HREF="http://postgis.refractions.net/documentation/postgis-doxygen/d1/da9/structserialized__lwgeom.html">serialized_lwgeom</A> in <A HREF="http://postgis.refractions.net/documentation/postgis-doxygen/d7/d54/structstruct__lwgeom__parser__result.html">LWGEOM_PARSER_RESULT</A><BR>
<BR>
and I think it should be done in <A HREF="http://postgis.refractions.net/documentation/postgis-doxygen/da/de7/liblwgeom_8h_4ede057556ebc967d6baa746cc9b3c5c.html#4ede057556ebc967d6baa746cc9b3c5c">lwgeom_from_ewkt</A> after the result are deserialized<BR>
<BR>
in the structure <A HREF="http://postgis.refractions.net/documentation/postgis-doxygen/d7/d54/structstruct__lwgeom__parser__result.html">LWGEOM_PARSER_RESULT</A> there is also room for a pointer to the LWGEOM version of the geometry, do we use that?<BR>
<BR>
<BR>
I have only tested those things above on trunk r6120 so maybe the parser rewriting is affecting.<BR>
<BR>
I am glad for any hint to help me understand.<BR>
<BR>
<BR>
Thanks<BR>
Nicklas
</BODY>
</HTML>