New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PlotItem leak since PySide6 6.5.0 #2672
Comments
No leak for PyQt6 6.5.0 either. |
Minimal pyqtgraph-free script that leaks on PySide >= 6.5.0 from PySide6 import QtCore, QtWidgets
import psutil
class Leaker:
def __init__(self):
parent = None
parent = QtWidgets.QWidget() # this line seemingly makes PySide < 6.5.0 not leak
wgt= QtWidgets.QSpinBox(parent)
wgt.valueChanged.connect(self.mkChangeCallback(wgt))
def mkChangeCallback(self, w):
return lambda *args: self.widgetChanged(w, *args)
def widgetChanged(self, w, *args):
pass
app = QtWidgets.QApplication([])
timer = QtCore.QTimer()
proc = psutil.Process()
rss0 = proc.memory_info().rss
cnt = 0
def timer_cb():
global cnt
rss = proc.memory_info().rss
print(f'{cnt}: {(rss - rss0)/1048576:.1f} MB')
Leaker()
cnt += 1
if cnt > 500:
timer.stop()
app.exit()
timer.timeout.connect(timer_cb)
timer.start(0)
app.exec() if hasattr(app, 'exec') else app.exec_() |
Hi, I'm one of the maintainers of Qt for Python. I'm currently investigating the leak and have reduced your script even further. The following code leaks on PySide >= 6.5.0, but not below: from PySide6 import QtCore, QtWidgets
class Leaker:
def __init__(self):
widget = QtWidgets.QWidget()
widget.windowIconChanged.connect(lambda *args: None)
app = QtWidgets.QApplication()
timer = QtCore.QTimer()
timer.timeout.connect(Leaker)
timer.start()
app.exec() I'd like to encourage you to create a bug report in our JIRA detailing your findings. Feel free to assign it to me. Thank you very much for discovering this leak. 😊 |
Hi @adrianghc The difference is the reference to |
We believe we have now fixed this bug: https://bugreports.qt.io/browse/PYSIDE-2299 It will be part of the PySide 6.5.1 release. Thank you for your patience, and let us know if you continue to have problems. |
fixed in PySide 6.5.1 but also worked around in #2694 |
Short description
Since PySide6 6.5.0, some objects within
PlotItem
will be leaked whenPlotItem
is destroyed.This issue is a spinoff from #2665 as this issue is specific to PySide6 6.5.0.
Code to reproduce
Additional
psutil
library is used to show memory growth.Expected behavior
Memory usage should stabilize.
Real behavior
Memory usage continues to grow with each iteration.
Tested environment(s)
Additional context
Doesn't occur for PySide2 5.12.2, PyQt5 5.15.9, PySide6 6.4.3, PyQt6 6.4.2
The text was updated successfully, but these errors were encountered: