[postgis-devel] Memory Leak (Two Senses)

Mark Cave-Ayland mark.cave-ayland at siriusit.co.uk
Thu Jan 8 02:31:38 PST 2009


Paul Ramsey wrote:

> On Wed, Jan 7, 2009 at 2:43 PM, Mark Cave-Ayland
> <mark.cave-ayland at siriusit.co.uk> wrote:
>> Yeah I can see the advantages in this, but of course there are lots of
>> implications. Users would have to dump/restore their databases for one, and
>> there would also be an increase in the size of data on disk (imagine the
>> padding required for a 64-bit system...).
> 
> We want 64-bit (double) alignment, so I don't think there's any
> difference, no?  And as far as I can see the cost is 3 bytes (which we
> can use anyways, for more space for typing)

Yes, but 64-bit == 8 bytes so there is a maximum padding cost of 7 bytes 
per geometry/subgeometry.

>> I suspect it would be fairly fast; but I'd like to see some concrete numbers
>> from a suitable test to ensure that the alignment/disk size tradeoff does
>> actually have a measurable improvement over just a plain aligned memcpy().
> 
> Oh fooey :)  I can see doing what you want as an interim step, then
> sliding the new approach beneath. Any change to something major like
> this will require careful code review, which will make subsequent
> changes easier, I hope.

Indeed. I'm inclined to try and keep the LWGEOM disk format unchanged 
from 1.3 to 1.4 just so that people can just upgrade and hence migrate 
away from 1.3 to the newer codebase as quickly as possible :)

> My concern about your approach is that, while it will (should) make
> the "whole geometry" ops like area calculations and predicate tests
> faster, the penalty on partial-geometry ops (PointN, RingN) is so
> large it could cause noticeable degradation for some users, a
> "downgrade" as it were.

Oh sure, which is why I suggested having both forms of geometry - an 
memcpy/aligned and a non-memcpy/unaligned type to handle both cases. I'm 
not quite sure yet whether it would be better to have a separate 
LWGEOM_ALIGNED type or add extra flags to LWGEOM though...


ATB,

Mark.

-- 
Mark Cave-Ayland
Sirius Corporation - The Open Source Experts
http://www.siriusit.co.uk
T: +44 870 608 0063



More information about the postgis-devel mailing list