Memory leaks whilst embedding python

Chris Williamson NewsReplys at aymara.tcp.co.uk
Fri Jul 23 17:25:24 EDT 1999


I'm experimenting with embedding python into an MFC prgram running under 
Windows NT.

I managed to build a debug version of the python dll ok, but when I tried 
running a simple script the MFC debugger complained of memory leaks.

Removing statements showed that the following leaked

void Button1_press() {

    	Py_Initialize();

}

Looking through the source I came to the conclusion that perhaps I should 
be doing the following:

void Button1_press() {

    	Py_Initialize();
    	Py_Finalize();

}

but this still leaked.

Further investigation revealed that at least one of the items which was 
leaking was some form of string object which was initialised whilst the 
python string module was loaded.


Can anyone cast any further light on this? 


    	    	    	Thanks,

    	    	    	    	Chris Williamson.




More information about the Python-list mailing list