This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Jack Liu
Recipients Jack Liu
Date 2016-09-19.08:56:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1474275397.88.0.0694521657076.issue28202@psf.upfronthosting.co.za>
In-reply-to
Content
I have a app loading python35.dll. Use python API PyImport_AddModule to run a py file. And use PyDict_DelItemString to delete the module. There is a global vailable in the py file. The global variable is not destroyed when calling PyDict_DelItemString to delete the module. The global variable is destroyed when calling Py_Finalize. It's too late. That cause the memory leak. Because the Py_Initialize is called at the app startup, the Py_Finalize is called at the app shutdown. 

But it is ok with python33.dll, the global variable can be destroyed when calling PyDict_DelItemString to delete the module.

How to resolve the problem? Is there a workaround? I need to use python35.dll and wish the global variable in a module can be released automatically when call PyDict_DelItemString to delete the module.

Here is the python test code:

    class Simple:  
         def __init__( self ):  
             print('Simple__init__')
         def __del__( self ):  
             print('Simple__del__') 
    
    simple = Simple()
History
Date User Action Args
2016-09-19 08:56:37Jack Liusetrecipients: + Jack Liu
2016-09-19 08:56:37Jack Liusetmessageid: <1474275397.88.0.0694521657076.issue28202@psf.upfronthosting.co.za>
2016-09-19 08:56:37Jack Liulinkissue28202 messages
2016-09-19 08:56:37Jack Liucreate