Memory management in GHashTable



I'm actually writing a GIndexedList based on the GList and the GHashTable. I want to check for memory leak, but if I insert an entry in the GHashTable and destroy the it the mem is not freed.
example:

#include <glib.h>
int main ()
  {
  GHashTable *h;
  h = g_hash_table_new (g_direct_hash, g_direct_equal);
  g_hash_table_insert (h, GUINT_TO_POINTER(1), GUINT_TO_POINTER(1));
  g_hash_table_destroy (h);
  g_blow_chunks ();
  return 0;
  }

If I run that in valgrind I got 2 blocks of mem still available, but not freed. How can I force the hash table to clear it's mem so that only my leaks are shown ?

thanks.

--
Kristian Benoit
xmms2 developper



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