Martin Dunschen added the comment:
Hello Antoine
Unloading would not be necessary if the DLL is just the python interpreter,
but if you build a DLL with python embedded that does quite a bit more than
some python interpreting (in my case complex C/C++ numerical calculations)
unloading the DLL
Martin Dunschen added the comment:
I have identified 5 cases where objects of type PyThread_type_lock are
allocated but never freed again:
import.c:
import_lock
pystate.c:
head_mutex
thread.c:
key_mutex
ceval.c:
interpreter_lock
zliblock.c:
zlib_lock
This leads to a
Martin Dunschen added the comment:
Here my suggested changes in plain text (I generated these as patches from a
diff to the current code):
thread.c:
353a354,359
> void PyThread_fini()
> {
> // should assert here that nkeys == 0
> PyThread_free_lock(keymutex);
> }
New submission from Martin Dunschen :
I found a number of 'handle leaks' in the core code to embed python into a
C/C++ application on windows.
To reproduce:
The simplest possible embedded application only calls:
#include
void entry()
{
Py_Initialize();
Py_Finalize();
}
I