Memory leak when using a C++ module for Python

Ulrich Eckhardt eckhardt at
Thu Dec 11 09:24:28 CET 2008

Jaume Bonet wrote:
> When I test the code from C++ each time I delete a vector the consumed
> memory decreases, but it does not happen when the module is called
> from python.

What is a "vector" for you? Do you mean std::vector? A vector allocated
using malloc()? A vector allocated using new? Just provide a simple piece
of C++ and Python example code that demonstrates the problem and you will
probably get help immediatel.

> I've read that the even when you delete the content of the vectors the
> memory is not freed when you are working with python. Is that so?

There are things like that, but without context it's pretty hard to tell
what's going on.


Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932

More information about the Python-list mailing list