-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
Short description
Using ErrorBarItem with PlotWidget causes small and gradual memleaks that become noticable when app is running a longer time.
Code to reproduce
This code is extracted from ErrorBarItem.drawPath() -> arrayToQPath(..., connect="pairs") which builds QPainterPath using QByteArray and numpy buffer interface.
Note that the same behaviour can be easily reproduced by calling ErrorBarItem.drawPath() repeatedly. Only the run is slower.
import numpy as np
from pyqtgraph.Qt import QtCore
if __name__ == '__main__':
n = 1024
for i in range(100000):
if i % 1000 == 0:
print('step', i)
backstore = QtCore.QByteArray()
backstore.resize(n * 8)
np.frombuffer(backstore, dtype=[('x', '>f8')], count=n)
input('done')Tested environment(s)
- PyQtGraph version: 0.13.7
- Qt Python binding: PySide6 6.8.2 Qt 6.8.2
- Python version: 3.12.9
- NumPy version: 2.1.3
- Operating system: Linux HOST 5.4.191-el7.lime.2.x86_64 # 1 SMP Thu Jul 14 19:09:52 EDT 2022 x86_64 x86_64 x86_64 GNU/Linux
- Installation method: conda
Additional context
I'm not sure if this bug is part of Qt or numpy, but it triggers inside pyqtgraph. As a workaround it would help to clear QByteArray before end of arrayToQPath(). In which case the memory footprint of the leak is very small.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels