memory leak in Gtk::Table::Attach?
- From: Łukasz Pełszyński <klakier lavabit com>
- To: gtkmm-list gnome org
- Subject: memory leak in Gtk::Table::Attach?
- Date: Wed, 22 Oct 2008 11:43:45 +0200
Hi,
My version of tkmm is 2.12.7-1 running under linux.
I've created a class which has Gtk::Table container. When content of table is recreated(cells removed and attached again) there is memory leak.
After 200 refreshes the leak is about 25 mb large.
I'm very certain that this is gtkmm or gtk fault.
I happens in Gtk::Table::Attach - when those lines are removed everything's okay.
The code:
Gtk::Table* Spreadsheet::getTable()
{
m_Entries.resize(m_Data.length());
for (int i = 0; i < m_Data.length(); i++) {
for (int j = 0; j < m_Data.width(); j++) {
Gtk::Button *b = manage(new Gtk::Button(m_Data[i][j].stringVal));
m_Entries[i].push_back(b);
m_Table->attach(*b,j+1,j+2,i+1,i+2,Gtk::FILL,Gtk::FILL);
}
}
return m_Table;
}
Spreadsheet::~Spreadsheet() {
}
void Spreadsheet::clear() {
//for each is #define for_each(x,var) for(int var=0; var < x.size(); var++)
for_each(m_Entries,i) {
for_each(m_Entries[i],j) {
m_Table->remove(*m_Entries[i][j]);
delete m_Entries[i][j];
}
m_Entries[i].clear();
}
m_Entries.clear();
}
//this happens 200 times
void Spreadsheet::redraw() {
clear();
getTable();
m_Table->show_all();
}
Thank you in advance.
--
Łukasz Pełszyński
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]