[postgis-devel] memory leak in converting foramts

Paul Ramsey pramsey at cleverelephant.ca
Sun Jan 17 08:33:14 PST 2010


On Sat, Jan 16, 2010 at 10:53 PM, chenzhen <zhenchen17 at gmail.com> wrote:
> Hi all,
>
> I have two questions about postgis:
>
> 1. Postgis  src code has divided into liblwgeom and postgis two components
> where liblwgeom is an abstract lib and postgis is relevant to postgresql.
> However, some functions such as **simplify2d_lwgeom **(in
> postgis\lwgeom_functions_analytic.c) I  think should be a part of
> liblwgeom(as the name of  src file) rather than in postgis. Is it designed
> to be this or  is it will be refined in the future?

Originally, *all* code was together in the postgis directory. In 1.4
it was somewhat separated. There is lots of work left to do to create
a clean separation.

> 2. Functions for converting formats may cause memory leak:
> For example : ** lwgeom_from_ewkt **, the call stack is :
> ----------------------------------------------------------------------------

Because everything runs in the PgSQL context right now, memory leaks
don't leak (they leak into the PgSQL function call memory context,
usually, so they are cleaned up almost instantaneous as the function
call ends), so we've probably got lots of them.

These two issues, the lack of a complete clean library and the fact
that the library has never been subjected to any kind of memory
purification makes liblwgeom still a pretty iffy proposition as a
standalone geometry library.

P.

> -----------
> -serialized_lwgeom_from_ewkt
> -lwgeom_deserialize
>        -lwpoint_deserialize (Point for example)
>                -pointArray_construct
> --------------------------------------------------------------------------
> As pointed in the comment of pointArray_construct:
> /*
>  * Constructs a POINTARRAY.
>  *
>  * NOTE: points is *not* copied, so be careful about modification
>  * (can be aligned/missaligned).
>  */
> Pointarray is not copied, that means the lwgeom object **must** together
> with a serialized object. After finishing using the lwgeom object, when and
> how to free the serialized object? Is it will cause memory leak?
>
> It is thankful if anyone answer my questions. Thanks a lot.
> Chenzhen
>
>
> __________ Information from ESET Smart Security, version of virus signature
> database 4778 (20100116) __________
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel
>



More information about the postgis-devel mailing list