On Wed, 16 Feb 2005 15:00:52 -0000 (GMT)
"Phil Thompson" <[EMAIL PROTECTED]> wrote:

> What version of Qt are you using? There was some talk of the Debian
> version of Qt leaking memory.

I'm using the latest Qt-mt library from Debian unstable, 3.3.3 (3:3.3.3-8).
What version are you using?

I'm attaching a C++ test and his output, in my machine it leaks, but much more
slowly than the previous python script. Also, the leak rate seems to be more
constant than the python one. 

Is possible that a Qt bug is impeding pyqt to deallocate his objects, so the Qt
leak get bigger by having attached the pyqt objects?

Btw, if you want, I can provide ssh access to the machine where this bug
happens.

Ricardo: Maybe it will be helpful if you post your tests to the list.


Saludos,
Nahuel Greco.

#include <qapplication.h>
#include <qmainwindow.h>
#include <qdialog.h>
#include <qevent.h>
#include <qfile.h>
#include <iostream>

class Main : public QMainWindow {
public:
	void keyPressEvent( QKeyEvent *k);
};

void presentMemData() {
        QFile f("/proc/self/status");
        QTextStream stream(&f);                                                
        QString line;          
        QStringList l;
        int vmsize = 0, vmrss = 0;

        f.open(IO_ReadOnly);
        while ( !stream.eof() ) {
                line = stream.readLine();
                l = QStringList::split(" ", line);
                if (l.size() > 1) {
                        if (line.startsWith("VmSize:"))
                                vmsize = l[1].toInt();
			if (line.startsWith("VmRSS:"))
                                vmrss = l[1].toInt();
                }
        }

        f.close();
        std::cout << "VmSize: " << vmsize
                  << "; VmRss: " << vmrss
                  << std::endl;
}


void Main::keyPressEvent(QKeyEvent *k) {
	if (k->key() == QKeyEvent::Key_Enter || k->key() == QKeyEvent::Key_Return) {
		std::cout << "Creating QDialog's" << std::endl;
		for(int i=0;;++i) {
			QDialog *d = new QDialog(this);
			delete d; 

			if(i%1000 == 0)
				presentMemData();
		}
	}
}

int main(int argc, char **argv)
{
     QApplication app(argc, argv);
     Main w;
     app.setMainWidget(&w);
     w.show();

     std::cout << "Focus the Window and press Enter for object creation / destruction loop" << std::endl;

     return app.exec();
}



Attachment: test_cpp_leak.log
Description: Binary data

_______________________________________________
PyKDE mailing list    [email protected]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

Reply via email to