[geos-devel] An Immodest Proposal

Paul Ramsey pramsey at cleverelephant.ca
Wed Oct 1 14:08:20 EDT 2008


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.


More information about the geos-devel mailing list