[geos-devel] An Immodest Proposal

Martin Davis mbdavis at refractions.net
Wed Oct 1 14:22:27 EDT 2008


Makes sense to me.  Basically this would take control of this 
initialization away from the compiler and place it in a function which 
is under user control.

And if the user forgot to call initGEOS they would get a nice segfault 
to remind them...

Paul Ramsey wrote:
> So, using a longer lived memory context I can get right to the end of
> a query before the segfault arrives. The segfault happens when
> deleting a geometryfactory at the end, which tells me a couple things,
> I think.
>
> First, those two std allocs that sneak in before we over-ride new are
> related to the geometry factory. The segfault happens when we're
> trying to pfree the geometryfactory.
>
> The offending code is this in geos_c.cpp:
>
> // NOTE: SRID will have to be changed after geometry creation
> static const GeometryFactory *geomFactory =
> 	GeometryFactory::getDefaultInstance();
>
> This global geomFactory is called a number of times by WKB readers and
> some other functions.  I wonder if we can initialize it in initGEOS
> and clean it up in finishGEOS?
>
> It appears, that this is what used to happen? Here's the current code.
>
> void
> finishGEOS ()
> {
> 	// Nothing to do
> 	//delete geomFactory;
> }
>
> Any help on the history behind this global?
>
> P.
> _______________________________________________
> geos-devel mailing list
> geos-devel at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geos-devel
>
>   

-- 
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022



More information about the geos-devel mailing list