Jambi Memory Usage

Danny Sporea dannysporea at yahoo.com
Fri Feb 8 23:54:08 CET 2008


Hi all,

I am trying to understand how Jambi uses memory and
when objects will be garbage collected. For example:

QDialog a = new MyDialog();
a.exec();

Somewhere inside MyDialog there is a button that, when
clicked, calls:

this.accept();

After calling accept or reject, is the dialog ready to
be garbage collected ? When will this happen ? How can
I make sure that the dialog will be collected after it
is closed ?

The same question about widgets inside other dialogs
(widgets). Will they be garbage collected and the
memory released after the parent widget is closed ?
How can I make sure this will happens and no dangling
object references remain ?

I know for sure that show() and hide() do not destroy
the widget, but what about accept and reject in case
of the QDialog ?

The same kind of question for what I saw one of our
developers doing, and I don't know if it is correct.
They have a QToolBox and, each time the QDialog is
shown (on showEvent), they clear the QToolBox with an
iterrative removeItem and then recreate it with
addItem (this needs to be done as the tool box changes
depending on external parameters). By doing this, does
the removeItem make the object (QItemWidget) ready for
garbage collection or there is an additional step that
needs to be done in order to be sure that it won't
create a memory leak ?

Sorry for the long email, but I really need to know
how to avoid memory problems and how to be sure that
an object will be garbage collected...

Thanks,
Danny 


      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 



More information about the Qt-jambi-interest mailing list