Monday, March 30, 2009

metaSendsEscape

Occasionally we can found that the Bash key-binding such as M-f/M-b will not work in XTerm (this happened both in my laptop and desktop), to solve this problem, just press `Control' and left mouse and check the item `Meta Sends Escape' from the main options.

To turn it on permanently, add the following line to configure file '/etc/X11/app-defaults/XTerm':

*metaSendsEscape: true

Wednesday, March 11, 2009

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:
  1. create hash table
  2. add hash entry
  3. g_thread_init()
  4. reclaim hash table
to:
  1. g_thread_init()
  2. create hash table
  3. add hash entry
  4. reclaim hash table
then, the error memory leak error just vanished.

Labels: ,