[postgis-devel] use of palloc() crashes server
strk
strk at keybit.net
Wed May 12 23:32:30 PDT 2004
On Wed, May 12, 2004 at 11:17:42PM -0400, Christoph Spoerri wrote:
> Hi there,
>
> I'm working on a couple new function for PostGIS (dyn. segmentation/linear
> referencing system). I ran now into the problem where postgresql crashes when
> I'm calling line_make(). I traced it down to the palloc() call within the
> line_make() function, but I have no idea what could cause the error.
>
> The line I'm creating has around 370 points, and the lines where the code
> crashes is:
> result= (LINE3D *) palloc (*size); (in file: postgis_inout.c)
>
> And just to make the problem more confusing:
>
> I run the following query (after logging in):
> select lrs_getshape(wkb_geometry, 1, 80) from test;
> => code crashes
>
> yet, if I run the following sequence:
> select lrs_getshape(wkb_geometry, 1, 20) from test;
> select lrs_getshape(wkb_geometry, 1, 80) from test;
> => code doesn't crash (????)
>
> It crashes again if I run the following sequence:
> select lrs_getshape(wkb_geometry, 1, 20) from test;
> select lrs_getshape(wkb_geometry, 1, 80) from test;
> select lrs_getshape(wkb_geometry, 1, 90) from test;
>
> Note: lrs_getshape() accumulates the necessary points to create a new 3D line.
>
> Any idea what could cause this? And thanks for your help,
What you describe is a tipical behaviour of pointers mess.
There's probably *always* an out-of-bounday condition, but
sometimes the faulty memory accessed is still allocated for
the process, sometimes not.
Try CVS postgis if possible.
--strk;
> Christoph
> _______________________________________________
> 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