[PyKDE] Memory leak when overriding QListViewItem.key()?
Fredrik Juhlin
laz at strakt.com
Thu Aug 15 15:06:00 BST 2002
Hi!
While trying to figure out the best way to control the sorting of a
QListView, I stumbled over what seems to be some sort of memory leak
when I override QlistViewItem.key().
When I run the code below, my python process uses aprox 58MB. If I
uncomment the key() method in MyListItem, it uses 150MB.
If there's a reasonable explanation for this that eludes me, or if I'm
simply doing something horribly wrong, please let me know :)
//Fredrik
#!/usr/bin/env python
import qt
import sys
class MyListItem(qt.QListViewItem):
def key(self, column, ascending):
return qt.QListViewItem.key(self, column, ascending)
pass
if __name__ == '__main__':
app = qt.QApplication(sys.argv)
lw = qt.QListView()
lw.addColumn('Mepp')
for x in xrange(5000):
li = MyListItem(lw)
li.setText(0, str(x))
app.setMainWidget(lw)
lw.show()
app.exec_loop()
More information about the PyQt
mailing list