[PySide] QTimer reference leaks in pyside vs pyqt

Josh Pieper jjp at pobox.com
Mon Jun 9 13:45:32 CEST 2014

Hello, I have an application that wants to repeatedly schedule
callbacks into the QT event loop.  With pyside, memory usage grows
over time, as python doesn't appear to be able to free things up.
objgraph shows a growing number of QTimer objects not being collected.
With pyqt, this is not a problem, and neither is it with a C++

I'm using pyside 1.2.1 on ubuntu 14.04.  My demonstration application
is below.  It is intended to busy loop, but with pyside, in addition,
eventually uses all memory on the machine.  If you replace PySide with
PyQt4, it busy loops just fine, and memory usage does not increase at
all over time.  I would have tried updating to 1.2.2, but it didn't
look like any resource issues were mentioned in the release notes.

Am I doing something wrong?



import sys

import PySide.QtCore as QtCore

def test():
    QtCore.QTimer.singleShot(0, test)

def main():
    app = QtCore.QCoreApplication(sys.argv)

if __name__ == '__main__':

More information about the PySide mailing list