Valgrind and GTK

Hi all,

I'm having trouble differentiating between memory leaks in my code and
apparent leaks in GTK when using valgrind.

Even the minimal hello world program from the GTK tutorial:

when run as follows (suppression file from

  export G_SLICE=always-malloc
  export G_DEBUG=gc-friendly
  valgrind --tool=memcheck --leak-check=full --leak-resolution=high \
    --num-callers=50 --show-reachable=yes --suppressions=gtk.suppression \
    helloworld > helloworld-vg.txt 2>&1

on Ubuntu 9.10 reports this:

  ==22566== LEAK SUMMARY:
  ==22566==    definitely lost: 1,449 bytes in 8 blocks
  ==22566==    indirectly lost: 3,716 bytes in 189 blocks
  ==22566==      possibly lost: 4,428 bytes in 107 blocks
  ==22566==    still reachable: 380,505 bytes in 7,898 blocks
  ==22566==         suppressed: 35,873 bytes in 182 blocks

If the leak summary of a 100 line demo program shows over 8000 definitely
lost, indirectly lost, possibly lost and and still reachable blocks, how
am I supposed to find the blocks of memory leaking from my code which is
30000 lines?

I would also like to note that this is a problem faced by other libraries
like GNU libc which solved the problem by adding a function __libc_freeres
to free all its program lifetime allocated memory.

I am aware of this bug:

and some of the discussion around it:

but I'm wondering if attitudes might have changed in the almost 10 years
since that bug and thread.

Erik de Castro Lopo

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