GNOME Bugzilla – Bug 653935
g_slist_free_full/g_list_free_full iterates twice in the list
Last modified: 2011-07-11 00:44:33 UTC
The following code could be used instead: while (list) { GSList *next = list->next; (*free_func) (list->data); g_slist_free_1(list); list = next; }
It seems there are some performance impact by using my code when using threads (g_thread_init()) since for each item it will cause g_mutex_lock() followed by g_mutex_unlock(). For non-threaded applications my version could probably be useful since it does not have this side effect.