Re: Tootaly free memory used by mem_chunk!!??



Mathieu LUGIEZ wrote:

Hello!!

I'm a french student so I want to prevent that my english is quite bad (Sorry)!!

I used glib for a C project based on HashTable.
I must totaly free all the dynamiquely allocated memory.
For test it I use the GMemVTable, but I realized that Glib doesn't free all memory used by mem_chunk when function like g_hash_table_destroy() is used. So I wrotte a personnal fuction in ghash.c to really free all the memory(at the end of the post).

My question is: Could you implement this type of function for the different basic types of Glib??
If the answer is no could you explain why?
Else I want help and work in this way.

void
g_hash_table_totaly_destroy(GHashTable* hash_table)
{
 g_hash_table_destroy(hash_table);
 g_return_if_fail(node_mem_chunk != NULL);
 g_mem_chunk_free(node_mem_chunk);
}

This question would have been more appropriate for gtk-list -- gtk-devel-list is for discussion about the development of GTK (and related libraries), rather than development with GTK.

If you want to disable the memory chunk code (which aren't really leaks), try compiling glib with the --disable-mem-pools argument to configure. This will make the memory chunk code equivalent to malloc() and free() calls.

James.



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