embeding problem 2: Py_Finalize didn't free all the memory

Patrick Blanchette pblanchette at pixelsystems.com
Wed Dec 13 20:08:17 CET 2000

   I'm embeding python in a WinNT application.  This application can run 
a python script.  Before executing a python script, the application 
calls the Py_Initialize function and executes the script.  After the 
script execution, the application calls the Py_Finalyze function.  I 
notice that the application use more memory than before the script 
execution, I suppose that the Py_Finalyze function didn't not cleanup 
the python interpreter completely.  If I try to execute another script, 
an error happens!
   If I call Py_Initialize and Py_Finalyze only 1 time, everything works 
correctly.  The problem is that my application use more memory after 
each script execution. 
   I tried to call Py_NewInterpreter() function before executing a 
script and the Py_EndInterpreter() at the end of each script but  the 
memory usage still grow rapidly.

   What should I do to keep the memory usage low?  My application is 
supposed to be able to run continuously without restart.

Thanks in advance

More information about the Python-list mailing list