pyside / PySide

ATTENTION: This project is deprecated, please refer to PySide2
https://wiki.qt.io/PySide2
GNU Lesser General Public License v2.1
291 stars 66 forks source link

memory leak on QtGui.QLabel.setPixmap #144

Closed hexxter closed 8 years ago

hexxter commented 8 years ago

Hi,

i grep frames from an webcam and display it on a QLabel and it works, but i see an memory leak.

class CameraDisplay(QtGui.QLabel):
    def __init__(self):
        super(CameraDisplay, self).__init__()

    def updateFrame(self, image):
        pm = QtGui.QPixmap.fromImage(image)
        self.setPixmap(pm)

del pm after set has nothing fixed, clear the pixmap cache has not fixed it....

i found this posting and it shows my problem: http://www.mzan.com/article/36663774-qimage-memory-leak.shtml

Info: Python3.4.3 virtualenv host: ubuntu 14.04 64bit

techtonik commented 8 years ago

How do you track leaking memory?

hexxter commented 8 years ago

Am 05.05.2016 um 05:11 schrieb anatoly techtonik:

How do you track leaking memory?

— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub https://github.com/PySide/PySide/issues/144#issuecomment-217066266

Hi,

it was not so easy i reduced the code and i see it by only comment out one line. But the setPixelmap was wrong i found it on:

https://github.com/PySide/PySide/issues/145

i postet my short testprogram. if you comment "image = QtGui.QImage(data, size[0], size[1], QtGui.QImage.Format_ARGB32)" out top shows a normal memory usage. But with this it you see the leak.

BR Alexander

techtonik commented 8 years ago

I see. I thought you were using some automated tool like https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer

mutenroshi2 commented 6 years ago

pm = qimage2ndarray.array2qimage(image) #Solution for the memory leak

techtonik commented 6 years ago

@ragu25 it is tracked in #145