[Metakit] [Fwd: memory leaks in python interface [was Hash view questions]]

Ralf Schmitt ralf at brainbot.com
Sat Mar 4 19:49:59 CET 2006


Ralf Schmitt schrieb:

> I'm pretty much convinced that the python wrapper code contains even 
> more leaks...
> Maybe I'll do some more tests...
> 

Turns out that the patch I sent may trigger segfaults .

The problem is that the PWOMappingMmbr class does not have a copy 
constructor and consequently just copies memory instead of counting 
references. C++ is such a pig. I didn't notice this the first time, 
since I think the compiler may or may not use a copy constructor for 
statements such as

PWOMappingMmbr res = PWOMappingMmbr(rslt, *this, _key);

depending on the compiler and optimizations being used.
In case it uses the "memcpy copy constructor", the _key member is being 
decrefed one too many times.


I'll send another patch.

- Ralf


More information about the Metakit mailing list