I\'m developing a library using a number of glib datastructures (GHashTable, GSList etc.). I\'ve been checking my code frequently for memory leaks using valgrind. Most of th
GLib has a few features that confuse Valgrind.
One is memory pools (g_slice in newer glib, "mem chunks" in older). These are specialized allocators used for small objects such as list nodes. You can use this to disable the slice allocator:
G_SLICE=always-malloc valgrind myprogram
A second issue is that sometimes GLib would avoid initializing new memory or keep dead pointers in freed slices/chunks. You can fix this with:
G_DEBUG=gc-friendly valgrind myprogram
So together of course:
G_DEBUG=gc-friendly G_SLICE=always-malloc valgrind myprogram
A third issue is that GLib has global variables that are simply never freed but considered permanent program state. For example registered GType are never unloaded, and a few others. This is not fixable, but valgrind should show these global allocations as reachable, rather than as lost.
glib-2.12 is quite old.
Try getting glib-2.24, compile and install it (with --prefix=/usr/local/glib-2.24 for example) then use it to compile your application.
If you still have this, try to read the glib manual again :)