Python 3.5.1 C API, the global available available is not destroyed when delete the module

Chris Angelico rosuav at gmail.com
Mon Sep 19 12:00:02 EDT 2016


On Mon, Sep 19, 2016 at 4:47 PM, dl l <ldlchina at gmail.com> wrote:
> 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. That
> cause the memory leak.

Does the module still exist in sys.modules? If so, it's not leaked -
it's still in use.

ChrisA



More information about the Python-list mailing list