[postgis-devel] && leaks
Mark Cave-Ayland
m.cave-ayland at webbased.co.uk
Thu Mar 11 05:35:00 PST 2004
Hi strk/Dave,
I've just had a quick look at ggeometry_consistent() and the GiST code,
and it looks as if the GiST code will pfree() the gistentryinit()
parameters for you. However it could be that memory leak strk's still
seeing after applying Dave's && patch could be the result of the
convert_box3d_to_box() being used in ggeometry_consistent() below:
in = (GEOMETRY*)PG_DETOAST_DATUM( entry->key );
if (in->nobjs ==0) // this is the EMPTY geometry
{
//elog(NOTICE,"found an empty geometry");
// dont bother adding this to the index
PG_RETURN_POINTER(entry);
}
else
{
r = convert_box3d_to_box(&in->bvol);
if ( in != (GEOMETRY*)DatumGetPointer(entry->key) )
{
pfree( in );
}
gistentryinit(*retval, PointerGetDatum(r), entry->rel,
entry->page,
entry->offset, sizeof(BOX), FALSE);
}
It doesn't look as if r is being pfree()d. strk, would applying Dave's
fix to this call to convert_box3d_to_box() aswell solve the memory leak
you are seeing?
Cheers,
Mark.
---
Mark Cave-Ayland
Webbased Ltd.
Tamar Science Park
Derriford
Plymouth
PL6 8BX
England
Tel: +44 (0)1752 764445
Fax: +44 (0)1752 764446
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender. You
should not copy it or use it for any purpose nor disclose or distribute
its contents to any other person.
> -----Original Message-----
> From: postgis-devel-bounces at postgis.refractions.net
> [mailto:postgis-devel-bounces at postgis.refractions.net] On
> Behalf Of strk
> Sent: 10 March 2004 12:07
> To: David Blasby
> Cc: PostGIS Development Discussion
> Subject: [postgis-devel] && leaks
>
>
> On Mon, Mar 08, 2004 at 07:27:26PM -0800, Dave Blasby wrote:
>
> (cuts)
>
> > You mentioned the compress function as another place it could be
> > leaking. Its
> > more difficult to tell exactly how its leaking because the line:
> >
> > gistentryinit(*retval, PointerGetDatum(r), entry->rel, entry->page,
> > entry->offset,
> sizeof(BOX), FALSE);
> >
> >
> > hides when the actual BOX (r) gets written to disk and can
> be pfreed.
> > I'll
> > have to look and see tomorrow.
> >
> > If you find/suspect any more leaks, let me know.
> >
> > dave
>
> After your patch applyed I found the leakage to happen at
> index creation time. If you create a gist index, then drop
> it, and start again, the postgres proces will growing over
> and over in size.
>
> --strk;
> _______________________________________________
> 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