[geos-devel] Request for change
Stefan Zschocke
s.zschocke at infozoom.de
Wed Mar 1 05:53:55 EST 2006
Hi, it was an assumption but turned out to be correct.
When switching to static const string, I again get the memory leaks
reported.
My main program for testing this is:
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(),
0))
{
// TODO: change error code to suit your needs
_tprintf(_T("Fatal Error: MFC initialization failed\n"));
nRetCode = 1;
} else {
geos::GeometryFactory factory;
}
geos::Unload::Release();
return nRetCode;
}
There no other references to geos.
With this program and const string-declarations for the errMsg[] I get the
following dump:
Detected memory leaks!
Dumping objects ->
{132} normal block at 0x003664F8, 32 bytes long.
Data: <Invalid Coordina> 49 6E 76 61 6C 69 64 20 43 6F 6F 72 64 69 6E 61
{131} normal block at 0x00366488, 48 bytes long.
Data: <Too few points i> 54 6F 6F 20 66 65 77 20 70 6F 69 6E 74 73 20 69
{130} normal block at 0x00366428, 32 bytes long.
Data: <Ring Self-inters> 52 69 6E 67 20 53 65 6C 66 2D 69 6E 74 65 72 73
{129} normal block at 0x003663C8, 32 bytes long.
Data: <Self-intersectio> 53 65 6C 66 2D 69 6E 74 65 72 73 65 63 74 69 6F
{128} normal block at 0x00366368, 32 bytes long.
Data: <Interior is disc> 49 6E 74 65 72 69 6F 72 20 69 73 20 64 69 73 63
{127} normal block at 0x00366308, 32 bytes long.
Data: <Holes are nested> 48 6F 6C 65 73 20 61 72 65 20 6E 65 73 74 65 64
{126} normal block at 0x003662A8, 32 bytes long.
Data: <Hole lies outsid> 48 6F 6C 65 20 6C 69 65 73 20 6F 75 74 73 69 64
{125} normal block at 0x00366248, 32 bytes long.
Data: <Topology Validat> 54 6F 70 6F 6C 6F 67 79 20 56 61 6C 69 64 61 74
Object dump complete.
Interestingly, 8 blocks are reported, whereas errMsg has 11.
Stefan
-----Original Message-----
From: geos-devel-bounces at geos.refractions.net
[mailto:geos-devel-bounces at geos.refractions.net] On Behalf Of
strk at refractions.net
Sent: Wednesday, March 01, 2006 11:36 AM
To: 'GEOS Development List'
Subject: Re: [geos-devel] Request for change
On Wed, Mar 01, 2006 at 11:25:48AM +0100, Stefan Zschocke wrote:
> The const does not make any difference, as the string constructor
> still is called.
> And the string-ctor does the dynamic memory allocation.
> With the string declaration the texts are actually duplicated in memory:
> once as constants and once as static string.
> Stefan
Did you check it or is it an assumption ?
I think C++ libs handle consts differently.
There are other cases of static allocations, btw, are you saying that this
is the ony one cousing that false leak reports ?
--strk;
_______________________________________________
geos-devel mailing list
geos-devel at geos.refractions.net
http://geos.refractions.net/mailman/listinfo/geos-devel
More information about the geos-devel
mailing list