0

I try only to update periodically the value in the first row of a (single column) GtkTreeView but the RAM consumption keeps growing!

Simplified excerpt :

static GtkListStore* liststore;
...
gboolean first_row_updater_timeout(gpointer user_data G_GNUC_UNUSED) {

GtkTreeIter  iter;
gtk_tree_model_get_iter_first(GTK_TREE_MODEL(liststore), &iter);
gtk_list_store_set (liststore, &iter, 0, "some text", -1);

return TRUE
} 

which is called in a g_timeout_add(10, (GSourceFunc) first_row_updater_timeout, NULL);

What I'm doing wrong?

  • "g_timeout_add" calls the function "first_row_updater_timeou"t in a interval of 10 milliseconds until it returns FALSE.(https://developer.gnome.org/glib/stable/glib-The-Main-Event-Loop.html#g-timeout-add).your ram consumption is increasing because this "first_row_updater_timeout" function is going in a infinite loop. – Siva Guru Jan 26 '19 at 11:57
  • Yes, just for the sake of simplicity. But why increasing? I expect `gtk_list_store_set()` to free the old stored string and replace it with the new one (which here is the same, again for simplicity) – WorkingClassHero Jan 26 '19 at 12:38
  • I observed that bad behavior on the macOS port. On Linux seems to be OK. – WorkingClassHero Jan 26 '19 at 12:51

0 Answers0