Details
-
Suggestion
-
Resolution: Unresolved
-
P2: Important
-
5.15.2
-
None
-
python 3.9.5
archlinux
-
-
f34dcb84a (dev), 47d4d01ac (6.7)
Description
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.
Attachments
Issue Links
- relates to
-
PYSIDE-2453 garbage collection fails when using QtCore.Property
- Reported
Gerrit Reviews
For Gerrit Dashboard: PYSIDE-1617 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
358830,5 | libshiboken: Fix string leaks in enums | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
359162,3 | Fix leak in QML ListProperty type | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
359302,2 | Fix leak in QML ListProperty type | 6.1 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
556924,4 | shiboken6: Fix leaking tuples in introduceWrapperType() | dev | pyside/pyside-setup | Status: MERGED | +2 | +1 |
557182,2 | shiboken6: Fix leaking tuples in introduceWrapperType() | 6.7 | pyside/pyside-setup | Status: MERGED | +2 | 0 |