[postgis-devel] Re: [HACKERS] GiST memory usage

strk at refractions.net strk at refractions.net
Tue Aug 16 07:37:58 PDT 2005


On Tue, Aug 16, 2005 at 03:12:07PM +0100, Mark Cave-Ayland wrote:
>  
> 
> > -----Original Message-----
> > From: strk at refractions.net [mailto:strk at refractions.net] 
> > Sent: 16 August 2005 12:29
> > To: Martin Daly
> > Cc: Paul Ramsey; Mark Cave-Ayland (External); 
> > postgis-devel at postgis.refractions.net
> > Subject: Re: [postgis-devel] Re: [HACKERS] GiST memory usage
> > 
> > 
> > I've done a pass on memory usage in GiST indexing.
> > It doesn't seem we're really leaking, anyway, in the unlikely 
> > event your tables are full of EMPTY or INFINITE geometries 
> > the change should reduce memory usage.
> > 
> > I'll be interested in hearing from you Martin about box-only 
> > version of the index. Does it still hit memory limits when 
> > DETOASTED values are smaller ?
> > 
> > Teodor Sigaev (GiST developer) reports he's been able
> > to build rtree indexing on 1e9 records...
> > 
> > --strk;
> 
> 
> Hi strk,
> 
> I had a quick look at this yesterday and think I found a small leak in
> LWGEOM_gist_picksplit. It's around line 1248 when the split direction is
> ambiguous - interLR and interBT are generated by BOX2D_intersects which
> pallocs() a new BOX2DFLOAT, however they are not pfreed() after the sizeLR
> and sizeBT comparison.
> 
> I've loaded in a couple of small shapefiles, but in those cases the
> ambiguous split code doesn't seem to get called even once. So unless with
> very large datasets the ambiguous split case occurs more often, I can't say
> that this will solve the problem entirely. However, I could provide a
> replacement liblwgeom.dll for Martin to test both our fixes if we can't find
> anything else.

Haven't I fixed that already ?
I committed a patch this morning, it now goes:


                sizeLR = size_box2d(interLR);
                sizeBT = size_box2d(interBT);

                if ( DatumGetPointer(interLR) != NULL )
                        pfree(DatumGetPointer(interLR));
                if ( DatumGetPointer(interBT) != NULL )
                        pfree(DatumGetPointer(interBT));

--strk;


> 
> 
> Kind regards,
> 
> Mark.
> 
> ------------------------
> WebBased Ltd
> 17 Research Way
> Tamar Science Park
> Plymouth
> PL6 8BT 
> 
> T: +44 (0)1752 797131
> F: +44 (0)1752 791023
> W: http://www.webbased.co.uk
> 



More information about the postgis-devel mailing list