thanks. I found that g_hash_table_insert allocate memory through magazine layer. But i do noting with magazine.
2010/4/9 richard boaz <[email protected]> > try rewriting as: > > - create using g_hash_table_new_full() > - remove the call to g_hash_table_foreach_remove() (or not, doesn't > matter) > > if you look at the documentation for g_hash_table_foreach_remove() you > might notice that the element will only be removed if the function called > returns true. except you provide NULL for the function which i have serious > doubts returns TRUE. > > look at it another way: why are you expecting the elements you insert will > be deleted when you make no accomodations for such in your code and the > documentation clearly states that you are responsible for (somehow) > arranging for the data to be freed? > > richard > > On Fri, Apr 9, 2010 at 12:22 PM, Tata <[email protected]> wrote: > >> Thank you, Some code like this: >> >> func1() >> { >> .. >> table_3= g_hash_table_new(g_direct_hash, g_direct_equal); >> .. >> } >> func2() >> { >> ... >> g_hash_table_insert(table_3, GUINT_TO_POINTER(key_3), value); >> .... >> } >> func3() >> { >> ... >> g_hash_table_foreach_remove(table_3, NULL, NULL); >> g_hash_table_destroy(table_3); >> ... >> } >> >> >> >> 2010/4/9 richard boaz <[email protected]> >> >> show your code, without it your comment is an opinion and not likely to >>> get much of an interesting response. >>> >>> why? because there are multiple ways of setting up hash tables, their >>> contents, and the automatic (or not) destroy functions which should be used. >>> >>> try again, >>> >>> richard >>> >>> On Fri, Apr 9, 2010 at 12:03 PM, Tata <[email protected]> wrote: >>> >>>> HELLO: >>>> >>>> When i destroy a GHashTable by g_hash_table_destroy, i found some >>>> memory leak. Hash func is g_direct_hash. Key equal func is g_direct_equal. >>>> There are more than 100,000 record in my GHashTable. >>>> >>>> Thanks. >>>> >>>> Austin >>>> >>>> _______________________________________________ >>>> gtk-list mailing list >>>> [email protected] >>>> http://mail.gnome.org/mailman/listinfo/gtk-list >>>> >>>> >>> >> >
_______________________________________________ gtk-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gtk-list
