-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
Short description
I've run into a memory leak in plotWidget using pyqtgraph 0.12.4, and PySide2 5.15.02. UpdateIntensity method clears and then plots on the plotWidget. Plots display correctly, but see constant memory growth. Confirmed disappears if I disable UpdateIntensity method.
Code to reproduce
from PySide2.QtCore import Qt
from Qt import (QtGui, QtCompat, QtCore, QtWidgets, __binding__, __binding_version__,
__qt_version__, __version__)
import pyqtgraph as pg
def UpdateIntensity(self):
# Plot pixel intensities
self.plotWidgetPixelIntensity.clear()
self.plotWidgetPixelIntensity.showGrid(x = True, y = True, alpha = 0.75)
self.plotWidgetPixelIntensity.setLabel('bottom', 'Pixel Intensity (counts)')
self.plotWidgetPixelIntensity.addLegend()
penRed = pg.mkPen(color=(255, 0, 0), width=2.0)
penBlue = pg.mkPen(color=(0, 0, 255), width=2.0)
penGreen = pg.mkPen(color=(150, 0, 0), width=5.0, style=QtCore.Qt.DashLine)
penPurple = pg.mkPen(color=(0, 0, 150), width=5.0, style=QtCore.Qt.DashLine)
self.plotWidgetPixelIntensity.enableAutoRange(axis='y')
self.plotWidgetPixelIntensity.setAutoVisible(y=True)
self.plotWidgetPixelIntensity.plot(
self.vr.grayBins,
self.vr.grayPDF,
pen = penRed,
brush = (255, 0, 0, 100),
fillLevel=0,
name = 'PDF Gray'
)
self.plotWidgetPixelIntensity.plot(
self.vr.grayBins,
self.vr.grayCDF,
pen = penGreen,
name = 'CDF Gray'
)
self.plotWidgetPixelIntensity.plot(
[
self.vr.centroidTrackThreshold,
self.vr.centroidTrackThreshold
],
[0, 1],
pen = penBlue
)
self.plotWidgetPixelIntensity.plot(
self.vr.threshGrayBins,
self.vr.threshGrayPDF,
pen = penBlue,
brush = (0, 0, 255, 100),
fillLevel=0,
name = 'PDF Thresh'
)
self.plotWidgetPixelIntensity.plot(
self.vr.threshGrayBins,
self.vr.threshGrayCDF,
pen = penPurple,
name = 'CDF Thresh'
)
# self.plotWidgetPixelIntensity.setLogMode(False, True)
# self.plotWidgetPixelIntensity.setRange(xRange=[0, 255], yRange=[-3, 0])
self.plotWidgetPixelIntensity.setRange(xRange=[0, 255], yRange=[0, 1])Expected behavior
I get to keep my memory :)
Real behavior
plotWidget eats my memory :(
Tested environment(s)
- PyQtGraph version: 0.12.4
- Qt Python binding: PySide2 5.15.2 Qt 5.15.2
- Python version: 3.7.9
- NumPy version: 1.21.6
- Operating system: Win 10
- Installation method: pip
Additional context
Also using Qt.py, and QtCompat.loadUi if that's meaningful.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels