[postgis-users] PostGIS memory leak bug

Kevin Neufeld kneufeld at refractions.net
Thu Aug 27 00:00:40 PDT 2009


Just thinking this through out loud here ... as I understand it, your 
test program runs two threads at the same time. 

Thread 1 inserts into a table with a simple geometry object.
Thread 2 selects from the same table at the same time the inserts are 
happening.

I'm not sure, but I think PGConn from libpq defaults to having 
autocommit set to true.  Nevertheless, you might not be experiencing a 
memory leak at all, but rather growing transaction blocks within postgresql.

Since you don't add a spatial index to your test table, it naturally 
takes longer and longer to query the table using ST_Contains in your 
select thread since the query would be performing sequential scans 
through the entire table every time.  So, as you perform a long running 
query against a table in one transaction block, you are inserting into 
the same table as fast as you can in a different transaction block ... 
and at the same time autovacuum kicks in trying to ANALYZE your growing 
table in a futile attempt to kept the stats up to date.

You probably see the memory allocations grow faster than normal due to 
the larger footprint of a geometry object.  I'm curious, do you see the 
memory climb using other data types?

Having said that, Regina is right that there were a few nasty leaks in 
GEOS a while back.  Make sure you are using the latest stable build.

-- Kevin

WANGRUNGVICHAISRI, SHIVESH wrote:
>
> We have an example program that should demonstrate a memory leak in 
> postgres.exe caused by PostGIS when used in a multi-threaded situation.
>
>  
>
> The link to the entire zip file is here:
>
>  
>
> http://www.2shared.com/file/7399978/56887b86/Postgis_Leak.html
>
>  
>
> OS: Windows XP 32-bit
>
> PostgreSQL: 8.3.7
>
> PostGIS: 1.3.6
>
>  
>
> Thanks,
>
>  
>
> S.
>
>  
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>   



More information about the postgis-users mailing list