Originally Posted by
tuan
Jacek, I tried valgrind --tools=massif mycode, however, it cored. I think that this might be due to the valgrind port under FreeBSD which somehow is not very stable.
Luckily it worked on my system. It seems that there are two problems. First of all QTableItems take a lot of space and there is a problem with memory fragmentation --- note the size of "heap-admin" strips.
I've managed to reduce memory size a bit by removing all of those null pixmaps that were created for each table item, but probably it won't be enough for you. Better try not to use QTableItems at all, as described here: http://doc.trolltech.com/3.3/qtable....n-large-tables.
int main( int argc, char **argv )
{
QTable table( numRows, numCols );
for ( int i = 0; i < numRows; ++i )
{
for (int j = 0; j < numCols; ++j)
{
QTableItem *item = new QTableItem( &table,
QTableItem
::OnTyping,
QString::number(i
), p
);
table.setItem( i, j, item );
}
}
app.setMainWidget( &table );
table.show();
return app.exec();
}
int main( int argc, char **argv )
{
QApplication app( argc, argv );
QPixmap p;
QTable table( numRows, numCols );
for ( int i = 0; i < numRows; ++i )
{
for (int j = 0; j < numCols; ++j)
{
QTableItem *item = new QTableItem( &table,
QTableItem::OnTyping, QString::number(i), p );
table.setItem( i, j, item );
}
}
app.setMainWidget( &table );
table.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks