[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    RE: [PyKDE] Memory leak in QFileDialog?
From:       "Tuvi, Selim" <stuvi () slac ! stanford ! edu>
Date:       2004-04-12 19:59:26
Message-ID: 4ABE591494FF5246B38C0CDA4CBFAFE8034FC5F4 () exchange4 ! slac ! stanford ! edu
[Download RAW message or body]

Thanks. Calling deleteLater() on the object after usage took care of the problem.

It never occurred to me to look at the web site FAQ, it may be worthwhile to add them \
to the PyQt documentation.

-Selim

Selim Tuvi, Research Engineering Group, SLAC
GLAST, I&T Online, MS 98
Tel:650-926-3376 Fax:650-926-4335
 

-----Original Message-----
From: Phil Thompson [mailto:phil@riverbankcomputing.co.uk] 
Sent: Saturday, April 10, 2004 12:00 PM
To: pykde@mats.imk.fraunhofer.de
Cc: Tuvi, Selim
Subject: Re: [PyKDE] Memory leak in QFileDialog?

On Saturday 10 April 2004 4:28 am, Tuvi, Selim wrote:
> I am experiencing memory leak like behavior when I use the instantiation
> method of opening a file with QFileDialog under Windows XP.
> 
> Attached is a modified version of the application.py script. If I click on
> "Open File" toolbar icon and escape out about 8 times then the task manager
> memory usage increases by about 1Kbytes.
> 
> I tried deleting the object after usage but that didn't change the outcome.
> 
> If I go back to using QFileDialog.getOpenFileName instead then I don't
> observe the memory increase.
> 
> I ran one of the Qt C++ examples that use it in a similar fashion and I
> don't see the memory leak there. The example is:
> C:\qt\3.3.1\examples\network\networkprotocol
> 
> Unfortunately I can not use the getOpenFileName way in my application since
> I am adding custom widgets to the file dialog window.
> 
> I am using SIP4 (snapshot-20040317), PyQt 3.11, Qt 3.3.1.

I think it's just the usual issue with deleting the children of a QObject. You 
are creating the dialog as a child of the main window - and therefore 
transferring ownership of it from Python to C++.

In order to delete it then you need to transfer ownership back the other way - 
see the FAQ. Or you could re-use the dialog each time rather than creating a 
new one each time.

Phil

_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic