Hi all,
has anyone else experienced memory leaks similar to what I had described a
couple of weeks ago? Is this my fault or Jambi's? Is there a known workaround?
Gunnar mentioned a "reference to the top-level" that is retained by mistake. It
would seem that every apllication that creates new QWidgets during runtime
would encounter this issue. Once again I attached my short example program.
Best regards, Curt
import com.trolltech.qt.gui.QApplication;
import com.trolltech.qt.gui.QHBoxLayout;
import com.trolltech.qt.gui.QLayout;
import com.trolltech.qt.gui.QPushButton;
import com.trolltech.qt.gui.QWidget;
public class QtLeak extends QWidget{
public static void main(String[] args) {
QApplication.initialize(args);
QtLeak testQtLeak = new QtLeak(null);
testQtLeak.show();
QApplication.exec();
}
public QtLeak(QWidget parent){
super(parent);
QLayout layout = new QHBoxLayout(this);
QPushButton buttonCreate = new QPushButton("Create", this);
buttonCreate.clicked.connect(this, "create()");
layout.addWidget(buttonCreate);
this.setLayout(layout);
}
@SuppressWarnings("unused")
private void create()
{
for(int i=0; i<1000; i++){
QtLeak leak = new QtLeak(null);
// leak.dispose();
}
}
}
_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest