I have a custom gtk.treeview
wrapper class that manages its own liststore. The class has its own method that clears the liststore's data and overwrites it with new data. For the purpose of testing memory consumption,the treeview just displays 50,000 rows of integers in 8 columns.
I've noticed that every call to my function that updates the liststore with data seems to increase the memory the application uses, and it never goes back down after data is cleared.
Here is my simple treeview implementation:
class TreeViewPrototype(gtk.TreeView):
def __init__(self):
gtk.TreeView.__init__(self)
self.columns = [str, str, str, str, str, str, str, str]
# Initialize Treeview and TreeViewColumns here
# Setup columns
self.liststore = gtk.ListStore(*self.columns)
self.set_model(self.liststore)
def set_list_model(self):
self.liststore.clear()
self.liststore = gtk.ListStore(*self.columns)
# Populate liststore with dummy data
for i in range(50000):
row = []
for j in range(len(self.columns)):
row.append("%d[%d]"%(i,j))
self.liststore.append(row)
It seems to me that every call to set_list_model, when I overwrite the liststore with a new one, it never unallocates the memory of the data. What am I doing wrong?