Re: GTK free function doesn't appear to have any affect.



On 06/14/13 13:24, Andrew Potter wrote:
On Fri, Jun 14, 2013 at 12:27 AM, dE <de techno gmail com> wrote:
I was monitoring the memory usage before and after execution of
g_object_unref and gtk_list_store_clear, and it didnt change the memory
usage by a bit.

Is this normal (am I doing it right?)?

e.g. --
gtk_list_store_clear (store);
g_object_unref( G_OBJECT (store) );
g_object_unref ( G_OBJECT ( col_renderer [j] ));
Do you have a treeview that is internally holding a reference to the list store?

I don't know about the GtkBuilder structures.

Also, g_new uses g_slice internally sometimes, and that will do things
like try to cache pages I think. Be sure to set the G_SLICE
environment variable to always-malloc when monitoring your memory
usage. See [1]

[1] https://developer.gnome.org/glib/2.36/glib-running.html

Before I unref and clear the ListStore I'm running gtk_tree_view_set_model (GtkTreeView *, NULL) on the TreeModel.

However there's a GtkTreeModelSort which holds the ListStore, this GtkTreeModelSort is then added to the TreeView.

I didnt find a way to unset the GtkTreeModelSort and the ListStore, but before I clear and unref the ListStore, I unref the GtkTreeModelSort.


    gtk_tree_view_set_model ( ddisplay , NULL );
    //unref to the TreeModelSort
    g_object_unref ( G_OBJECT ( inter_sort ) );

    gtk_list_store_clear (store);
    g_object_unref( G_OBJECT (store) );

Setting export G_SLICE=always-malloc did nothing.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]