[geos-devel] Memory Leak In GEOSIntersection_r

Sandro Santilli strk at keybit.net
Thu Feb 12 07:35:38 PST 2015

On Sat, Jan 24, 2015 at 12:41:28AM +0000, Mick Orridge wrote:
> This is my first post here, so feel free to let me know if I should
> be doing things differently.
> I've been using the nightly snapshot from 4/1/2015 to generate
> Voronoi polygons and then clip them to the UK coastline on Windows
> 8.1 with VS2013. After processing several 100,000 polygons with
> GEOSIntersection_r my laptop was running out of memory.
> I've investigated further and it looks like the Edges rejected by
> OverlayOp::insertUniqueEdges in OverlayOp.cpp are not being deleted.

I think they are deleted later. If you hadn't seen this yet please
provide a testcase showing the leak. See tests/unit/capi/ for a good

> There is also a small memory leak of a geomFactory in
> init/finishGEOS(). The only way I can see to fix this is to
> introduce a reference count and then null the static pointer when it
> reaches 0. Happy to have a look at fixing this if this seems a
> reasonable approach.

I think that one is not important. IIRC it once was a class-static
and could be deleted by the Unload class, not sure if that's still the case.


  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html

More information about the geos-devel mailing list