[python-win32] Memory leak when importing in embedded python

Mark Hammond mhammond at skippinet.com.au
Thu Aug 21 02:51:05 CEST 2008

> Hi
> Importing some modules[2] in embedded python between Py_NewInterpreter
> and
> Py_EndInterpreter[1] cause memory leak. Not all the modules cause leaks
> (ex
> sys module) but most of them do! And none of them cause any leak when
> they
> are not embedded! What cause this? Is it solveable?

Its probably not solvable.  Py3k, IIUC, has some changes to make it
solveable, but even then you will be relying on each module doing the right
thing.  Google will show you *lots* of references to this problem.  The
simple answer is to not init/finalize Python multiple times.


More information about the python-win32 mailing list