[postgis-devel] memory leak in converting foramts

chenzhen zhenchen17 at gmail.com
Sat Jan 16 22:53:30 PST 2010


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?

2. Functions for converting formats may cause memory leak:
For example : ** lwgeom_from_ewkt **, the call stack is :
----------------------------------------------------------------------------
-----------
-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
 




More information about the postgis-devel mailing list