Hello, I wrote a version of mem.py in C++, and have put the data side by side in a spreadsheet. It appears that a PyQt program more overhead has in terms of libraries over C++, roughly 8Mb in this test for me. When running, the memory usage pattern seems to mirror the C++ program with perhaps a little bit of overhead per object, ~10% (ballpark figure).
What is needed now is some tests that create lots of Qt objects, and then see how object creation affects memory usage. Using Mandrake Linux 10.1, Qt-3.3.3, SIP 4.0.1 (I think, from kdebindings 3.3.1) cheers, -- Simon Edwards | Guarddog Firewall [EMAIL PROTECTED] | http://www.simonzone.com/software/ Nijmegen, The Netherlands | "ZooTV? You made the right choice."
PyQt_memory_usage.xls
Description: application/msexcel
/* */ #include <qapplication.h> #include <qstringlist.h> #include <qpushbutton.h> #include <qfile.h> void ProcMem() { QStringList lines; QFile file("/proc/self/status"); if(file.open( IO_ReadOnly ) ) { QTextStream stream( &file ); QString line; while ( !stream.atEnd() ) { line = stream.readLine(); // line of text excluding '\n if(line.startsWith("V")) { printf( "%s\n", line.latin1() ); } lines += line; } file.close(); } } int main( int argc, char ** argv ) { printf("\nInitial values\n"); ProcMem(); printf("\nCreate QApplication\n"); QApplication *qapp = new QApplication( argc, argv ); ProcMem(); printf("\nCreate Pushbutton\n"); QPushButton *b = new QPushButton("&Hello World", 0); qapp->setMainWidget(b); ProcMem(); printf("\nShow Pushbutton\n"); b->show(); ProcMem(); printf("\nConnect Pushbutton signal\n"); qapp->connect(b, SIGNAL(clicked()), qapp, SLOT(quit())); ProcMem(); printf("Enter Mainloop\n"); qapp->exec(); ProcMem(); printf("Mainloop finished\n"); ProcMem(); printf("Delete Pushbutton\n"); delete b; ProcMem(); printf("Delete Application\n"); delete qapp; ProcMem(); return 0; }
_______________________________________________ PyKDE mailing list PyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde