Memory leaks related to pyqtSignals

kristof.mulier at telenet.be kristof.mulier at telenet.be
Fri Jan 29 12:32:56 GMT 2021


Hi, 

I've been reading the mail thread from September 2019 concerning "Possible memory leak with signal connections". The last mail from this thread is this one: 

[ https://www.riverbankcomputing.com/pipermail/pyqt/2019-September/042180.html | https://www.riverbankcomputing.com/pipermail/pyqt/2019-September/042180.html ] 

The mail ends like this: 

> [Phil] Are you expecting that the Python interpreter will return unused memory 
to the operating system? 

> [Kevin] My assumption was that the memory usage from the signal connections wouldn't "build up" (i.e. that memory usage would be independent of the number of SignalObjects instantiated), which seems to be what happens with the pyqtSlot decorated version. In create_slot_objects, each SlotObject is instantiated, which connects the signals, and then should be immediately garbage collected, which should disconnect the signals. In the version of the script without the pyqtSlot decorators, the number reported for "Memory after slot objects creation" is proportional to the number of SlotObject instances created, which is why I'd assumed memory had leaked, but I could certainly be thinking through things wrong. 

I would like to know how the story ends. Is this an actual memory leak? Or is it *just* the Python interpreter keeping the unused memory to itself? 

I've got some more questions regarding properly "destroying" QtObject()s and their signals. If you have time, please have a look here: [ https://stackoverflow.com/questions/65953772/will-the-following-code-disconnect-all-incoming-or-outgoing-pyqt-signals | https://stackoverflow.com/questions/65953772/will-the-following-code-disconnect-all-incoming-or-outgoing-pyqt-signals ] 

Thank you very much :-) 

Kind regards, 
Kristof 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210129/f1478abe/attachment.htm>


More information about the PyQt mailing list