-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
openGLIssues relating to 3D/openGLIssues relating to 3D/openGL
Description
pyqtgraph 0.10.0
Python 3.5
Qt 5.6.2
I came across a issue and suppose it is a memory leak, maybe similar to #103
When I update vertices of a gl.GLMeshItem using its method .setMeshData() I loose memory each time it updates. You can reduce n_tri for a less severe example ;)
A working example is
# -*- coding: utf-8 -*-
from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
import pyqtgraph as pg
import pyqtgraph.opengl as gl
app = QtGui.QApplication([])
mw = QtGui.QMainWindow()
mw.setWindowTitle('pyqtgraph example: PlotWidget')
mw.resize(800,800)
cw = QtGui.QWidget()
mw.setCentralWidget(cw)
l = QtGui.QGridLayout()
#l.setRowMinimumHeight(0, 400)
cw.setLayout(l)
w = gl.GLViewWidget()
w.setBackgroundColor(0.9)
w.setCameraPosition(distance=3)
l.addWidget(w, 0, 0, 1, 1)
sp = w.sizePolicy()
w.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding))
mw.show()
n_tri = 10000
vertices = np.random.uniform(size=(n_tri, 3, 3))
colors = np.random.uniform(size=(n_tri, 3, 4))
m1 = gl.GLMeshItem(vertexes=vertices, faces=None, vertexColors=colors, smooth=False,
drawEdges=False, drawFaces=True, edgeColor=(0, 1, 0, 1))
w.addItem(m1)
def update():
vertices = np.random.uniform(size=(n_tri, 3, 3))
m1.setMeshData(vertexes=vertices, faces=None, vertexColors=colors, smooth=False,
drawEdges=False, drawFaces=True, edgeColor=(0, 1, 0, 1))
t2 = QtCore.QTimer()
t2.timeout.connect(update)
t2.start(500)
if __name__ == '__main__':
import sys
if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
QtGui.QApplication.instance().exec_()
Any ideas what causes this and if there is a workaround or a fix?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
openGLIssues relating to 3D/openGLIssues relating to 3D/openGL