[PySide] Is there a tutorial on good debugging techniques for PySide?

Kevin Cole dc.loco at gmail.com
Tue Feb 16 17:26:55 CET 2016


On Mon, Feb 15, 2016 at 2:56 PM, Stefan Champailler
<schampailler at skynet.be> wrote:

> Alas poor Kevin,
>
> You most probably felt into the memory leaks/garbage collections issue.
>
> Since Qt is C++ and PySide is python, there's a mismatch in the memory models (C++ is managed memory, python is garbage collected). You have to think about that when developping. PySide is quite OK to work with, but you have to have this aspect in mind...
>
> For my part, I've tried detecting memory leaks and GC conflicts with a debug/valgrind-ready python/qt/pyside but it didn't help much. The easiest is to double check your code for memory problematic code... That's the bad side of PySide (and PyQt as well I think)
>
> Stefan

Thanks! This did, indeed, appear to be the case, and I merely "got
lucky" -- or unlucky -- when one of the two programs worked. In both
programs, I was instantiating and showing a new dialog at the end of a
method. In one case, the method returned but the dialog stayed alive:
the behavior I had intended. However, based on what I've been reading,
this was purely by accident, since I was also closing the dialog that
instantiated the second dialog. In the second program, garbage
collector decided to collect.  At least, that is my understanding
based on what you and others have steered me towards.



More information about the PySide mailing list