Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Garbage collection with QT

Reply
Thread Tools

Garbage collection with QT

 
 
Marco Bartel
Guest
Posts: n/a
 
      06-08-2005
Hello,
I got a question regarding garbage collection in python when using PyQT.
How can i safely get rid of an Object instance and delete it
permanently. For example when having a QTable with a bunch of records
inside and closing the window hosting it, the memory space will not
being freed up and when opening it again, the memory usage will grow.
This ends up, when opening and closing the window serval times, in
having all swapspace occupied and OS crashing.

Is there a way, to find out all references to the QMainWindow or its
hosted QTable, for having a mechanism to destroy them?

THX
Marco
 
Reply With Quote
 
 
 
 
Mike Tammerman
Guest
Posts: n/a
 
      06-08-2005
Not all leakage problems caused by qt or python. There is a wrapping
layer between Qt and Python provided by SIP. Therefore, SIP may cause
leakages. Also PyQt had a paintCell memory leakage problem several
months ago. If you're using an old snapshot of PyQt or SIP, that would
be a problem. Try using the latest snapshots. Also mention your
versions and problems to the PyKDE mailinglist, it could be more
helpful.

If you want to delete C++ objects in Qt, consider using
QObject.deleteLater() method. IMHO, this won't help.

Mike

 
Reply With Quote
 
 
 
 
Ken Godee
Guest
Posts: n/a
 
      06-08-2005
> Is there a way, to find out all references to the QMainWindow or its
> hosted QTable, for having a mechanism to destroy them?
>

Yes, of coarse, the docs are your friend

QObject::children()
QObject::removeChild()
QObject:arent()

To find all the children for an instance you
can create a loop.

An example of a dialog window function
that cleans it self up ....

================================================
def xdialog(self,vparent,info):

vlogin = dialogwindow(parent=vparent,modal=1)

while 1:

vlogin.exec_loop()

if vlogin.result() == 0:
vparent.removeChild(vlogin)
del vlogin
break
================================================



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Collection problems (create Collection object, add data to collection, bind collection to datagrid) Řyvind Isaksen ASP .Net 1 05-18-2007 09:24 AM
Templates - Garbage In Garbage Not Out ramiro_b@yahoo.com C++ 1 07-25-2005 04:48 PM
Garbage Collection kamran MCSD 1 04-04-2005 10:04 PM
Garbage Collection and Manage Code? Laser Lu ASP .Net 5 01-27-2004 03:48 AM
Debbugging help! (.NET 1.1 Framework Garbage Collection Problems) Cheung, Jeffrey Jing-Yen ASP .Net 3 07-10-2003 07:29 PM



Advertisments