Memory leak in PyQt application

David Boddie david at boddie.org.uk
Thu Jun 28 18:54:37 EDT 2007


On Thu Jun 28 19:21:36 CEST 2007, Alexander Eisenhuth wrote:

> I've a memory leak in a PyQt application and no idea how to find it. What 
> happens in the application ?
> 
>  From QWindow a QDialog is called on a button "pressed()" signal, that 
> instantiate a QThread and waits for it. If the thread has finished, the
> QDialog closes.

Do you delete the dialog when you close it? Did you create it with a parent
object?

> I've stipped down everything that nothing more happens (to me obviously). 
> Boost.Python is used to wrap a C++ Lib (used in the thread). Every time
> memory usage increases for ~70 KB.
>
> Sometimes the application crash on closing QWindow. (QtCore.dll)
>
> - One thing I ask me is weather garbage collection is done in the PyQt main
> loop?

Some objects will be garbage collected but others may will be kept around
if they are used from C++.

> What hints do you have to find the leak?

You may need to show us some of your code so that we can see exactly what
you're doing. If you can post the stripped down example you have here, we
can take a look at it.

David



More information about the Python-list mailing list