diff options
author | Sebastian Wilhelmi <wilhelmi@ira.uka.de> | 2000-04-17 13:23:27 +0000 |
---|---|---|
committer | Sebastian Wilhelmi <wilhelmi@src.gnome.org> | 2000-04-17 13:23:27 +0000 |
commit | 8c90d7766b1708a8bcb3cb96988b6b7fc92c2e59 (patch) | |
tree | 9bf74b09c3cd4b70ab5216e8085c41d3dec24f8f /gslist.c | |
parent | 03f9d485c1435c342c936a26626dda440c1911b9 (diff) |
Add configure test for garbage collector friendliness for GLib. If
2000-04-17 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in, acconfig.h: Add configure test for garbage
collector friendliness for GLib. If enabled, ENABLE_GC_FRIENDLY
will be defined.
* garray.c, ghash.c, glist.c, gmain.c, gmem.c, gnode.c, gqueue.c,
gslist.c, gtree.c: If ENABLE_GC_FRIENDLY is defined, NULLify all
memory released by the user, but cached by GLib. This lets a
garbage collector have a more correct view of the actually used
memory.
Diffstat (limited to 'gslist.c')
-rw-r--r-- | gslist.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -151,9 +151,21 @@ g_slist_free (GSList *list) { if (list) { - list->data = list->next; + GSList *last_node = list; + +#ifdef ENABLE_GC_FRIENDLY + while (last_node->next) + { + last_node->data = NULL; + last_node = last_node->next; + } + last_node->data = NULL +#else /* !ENABLE_GC_FRIENDLY */ + list->data = list->next; +#endif /* ENABLE_GC_FRIENDLY */ + G_LOCK (current_allocator); - list->next = current_allocator->free_lists; + last_node->next = current_allocator->free_lists; current_allocator->free_lists = list; G_UNLOCK (current_allocator); } |