-
Suggestion
-
Resolution: Unresolved
-
P2: Important
-
5.15.2
-
None
-
python 3.9.5
archlinux
-
-
f34dcb84a (dev), 47d4d01ac (6.7)
the following code exhibits quite some memory leaks already, and using more of PySide only makes it worse:
#include <Python.h>
#include <QCoreApplication>
#include <QDebug>
using namespace std;
void test()
{
qWarning() << "init";
Py_Initialize();
{
auto mainModule = PyImport_ImportModule("__main__");
auto globalDict = PyModule_GetDict(mainModule);
auto compiled = Py_CompileString("from PySide2 import QtCore\n", "test.py", Py_file_input);
qWarning() << compiled;
auto ret = PyEval_EvalCode(compiled, globalDict, globalDict);
qWarning() << ret;
Py_XDECREF(ret);
Py_XDECREF(compiled);
Py_XDECREF(mainModule);
}
Py_Finalize();
qWarning() << "deinit";
}
int main(int argc, char** argv)
{
QCoreApplication app(argc, argv);
test();
return 0;
}
Compile it with LSAN or use memcheck and set `PYTHONMALLOC=malloc` and you'll see a huge list of leaks. I'll attach the log file as it's far too large to paste it here directly.
My expectation would be that a call to Py_Finalize would also unload all shiboken state.
- relates to
-
PYSIDE-2453 garbage collection fails when using QtCore.Property
-
- Reported
-