g_thread_init
This afternoon I spent almost two hours hunting a memory leak reported by valgrind. It said that there are 2034 bytes definitely lost in g_hash_table_new_full(), but I am pretty sure that g_hash_table_destroy() is invoked with each key been passed to g_free().
The fix turned out to be a slight modification of call sequence to g_thread_init(), from:
The fix turned out to be a slight modification of call sequence to g_thread_init(), from:
- create hash table
- add hash entry
- g_thread_init()
- reclaim hash table
- g_thread_init()
- create hash table
- add hash entry
- reclaim hash table
Labels: Linux, programming
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home