[postgis-users] Union as an aggregate

David Blasby dblasby at refractions.net
Mon Sep 29 13:49:33 PDT 2003


strk wrote:
> I made my dumbass-mode aggregate (unite!).
> It eats up all available memory, which remains allocated
> also at the end of function run.
> Does it sound as a postgresql bug ?
> 
> To reduce memory occupation it might be useful to release detoasted
> values passed as arguments to geomunion with pfree, because
> those allocations might remain 'till the end of the aggregate
> run, but I'm not sure about palloced values life/aggregates.

I havent noticed postgresql chewing memory.  But, I must admit I dont 
check that very carefully.  Postgresql will automagically pfree() 
anything you palloc() at the end of the SQL statement.

Are you releasing your GEOS geometries?  You have to be careful because 
they use malloc() instead of palloc().

Are you using the most up-to-date PostGIS and GEOS?

If so, send me the code to unite() and I'll take a quick look at it.

dave




More information about the postgis-users mailing list