Memory leak when embedding Python 2.2?

Mark Hammond mhammond at skippinet.com.au
Wed Jan 16 22:35:31 EST 2002


Jens Scheidtmann wrote:

> Dear Readers,
> 
> I am trying to embed Python 2.2 in my MS Visual C++ project.
> The debug facilities of VC++ detect memory leaks with Python, but not
> without Python. 
> 
> I have an CPhyton object only with constructor and destructor. 

...

> On exit of the application the debugging facilities of VC++ report lots
> of 
> memory leaks, which are gone, if I comment out the Py_Initialize and
> Py_Finalize in the Python-object. 


These are one-off allocations Python makes and never frees.  They are 
not "leaks" in the sense that they never grow over time.  They can 
largely be ignored.

Python *will* leak a little in the face of multiple 
Py_Initialize()/Py_Finalize() calls, but this is rare.

Mark.




More information about the Python-list mailing list