Re: Possble problem with g_hash_table_remove() not resizing table



Looks like you're doing something wrong, you're freeing
the keys and then trying to remove the nodes based on
those keys.

The hash table just stores a pointer to your keys, so after
freeing them, they are no longer valid, so its just luck that it
normally works (and as you find, dependent on the implementation of
free()).

> 	g_free(ori_key);
> 	g_free(ori_val);
> 	g_hash_table_remove(table, (gpointer)&lkey);

> I would expect the table size to be zero at the end, instead it is 1208.
> Is something wrong or am I doing this wrong?
> 





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