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 /ghash.c | |
parent | 03f9d485c1435c342c936a26626dda440c1911b9 (diff) | |
download | glib-8c90d7766b1708a8bcb3cb96988b6b7fc92c2e59.tar.gz |
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 'ghash.c')
-rw-r--r-- | ghash.c | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -380,6 +380,12 @@ g_hash_node_new (gpointer key, static void g_hash_node_destroy (GHashNode *hash_node) { + +#ifdef ENABLE_GC_FRIENDLY + hash_node->key = NULL; + hash_node->value = NULL; +#endif /* ENABLE_GC_FRIENDLY */ + G_LOCK (g_hash_global); hash_node->next = node_free_list; node_free_list = hash_node; @@ -394,8 +400,19 @@ g_hash_nodes_destroy (GHashNode *hash_node) GHashNode *node = hash_node; while (node->next) - node = node->next; - + { +#ifdef ENABLE_GC_FRIENDLY + node->key = NULL; + node->value = NULL; +#endif /* ENABLE_GC_FRIENDLY */ + node = node->next; + } + +#ifdef ENABLE_GC_FRIENDLY + node->key = NULL; + node->value = NULL; +#endif /* ENABLE_GC_FRIENDLY */ + G_LOCK (g_hash_global); node->next = node_free_list; node_free_list = hash_node; |