[geos-devel] RE: memory leaks in Bigtest

Stefan Zschocke s.zschocke at infozoom.de
Wed Feb 22 11:16:09 EST 2006

Update: I changed all the *new Coordinate() calls in the
GeometryTestFactory to Coordinate(..)
and now the leaks are significantly reduced to 10 allocations. These 10
allocations however result from just calling 
	GeometryFactory fact;
in the main-function. Even if all of the run-calls are commented out,
the leak of 10 objects remains.

-----Original Message-----
From: Stefan Zschocke 
Sent: Wednesday, February 22, 2006 4:55 PM
To: 'geos-devel at geos.refractions.net'
Subject: memory leaks in Bigtest

I just downloaded and compiled the Geos code. I tried the bigtest sample
and found it leaks memory like hell. I hate having leaking test programs
as it prevents from checking wether the leak is in the test or the
library itself. First things I did: in the main, make GeometryFactory a
local stack variable, and in run-function delete the 2 polygons after
use. But it still leaks. I assume the leaks result from the code in
GeometryTestFactory.cpp. Does someone have a clean
GeometryTestFactory.cpp, which doesn't leak?

Otherwise I would have to check the code in this file to produce a
non-leaking version. I already had a look at it, and saw many
dynamically-created objects go into ctors as parameters. Checked a few
and the ctors looked like they needed these objects permanently, because
there were other ctor-overloads with const-reference parameters, which
cloned the const-parms. But somewhere there must be a fat leak.

Thx, Stefan

BTW: I did the test with VS.Net under XP. I slightly modified the code
to build a GEOS.DLL. Just put a dllExport-macro in the class
declarations, but this would not affect the memory

More information about the geos-devel mailing list