Memory Leak Tool with GLib Applications



Hi,

I am using glib as a foundation library for some C application developments.

I have been using mpatrol, as a memory leakage detection tool. However, when I use mpatrol with glib applications, it reports some false memory leaks. Does anyone have any experience of using mpatrol with glib applications?

It seems that glib allocates some blocks of memory and keep reusing them. When the application quits, it relies on the OS itself to free the memory.

However, for those memory leak detection tool, such as mpatrol, it reports those unfreed memory blocks as memory leak. With those false alarms, it is very difficult to distinguish false and real memory leaks.

For example, when g_thread_init() is called, mpatrol reports, many
memory leakages. (I use MPATROL_OPTIONS=LOGALL and the mleak tool).

> 0x0804F89C (24 bytes) {malloc:226:0} [1024|-|-|-]
> 0x400D4D05 g_malloc+33
> 0x400AB4EA g_mutex_new_posix_impl+26
> 0x400D66AE g_mem_init+46
> 0x400AC60D g_thread_init+525
> 0x080496F6 ???
> 0x42017499 __libc_start_main+149
> 0x080495E1 ???

Is any way to use mpatrol with glib applications? Or is there any other memory leakage tool which works with glib nicely?

Does glib provide some destruction functions for cleaning up those unused memory blocks when application quits?

Thank you very much.

Tony Cheung




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