[geos-devel] Question about geos::io::Unload::Release()

Mateusz Łoskot mateusz at loskot.net
Sat Mar 11 15:02:42 EST 2006


strk at refractions.net wrote:
> Geometry::INTERNAL_GEOMETRY_FACTORY should really
> be a singleton, probably GeometryFactory::getInternalInstance()

Is this internal factory used at all?
First, I see the only function using it is marked as deprecated:

headers/geos/geom/Geometry.h
/// @deprecated
//Geometry* toInternalGeometry(const Geometry *g) const;

/// @deprecated
//Geometry* fromInternalGeometry(const Geometry *g) const;

Second, I see it's a static data member, so it's a singleton - only one
copy shared between all instances of Geometry class.
According to my current knowledge of GEOS,
Geometry::INTERNAL_GEOMETRY_FACTORY
could be declared as a static data member but non-pointer.
Then no deletion is required

struct A;
struct B
{
static A a_; // static lifetime
}


> Unload class has been introduced to procrastinate these kind
> of cleanups :) Your assumption is correct, should only be
> called as *last* action of a *debuggin* module, no need
> to be called by user code, it's just there to avoid false leaks
> reported by memory checkers.

I understand, but this gadget causes some difficulties in Unit Tests ;-)


Cheers
-- 
Mateusz Łoskot
http://mateusz.loskot.net




More information about the geos-devel mailing list