Re: Valgrind and GTK
- From: Sven Neumann <sven gimp org>
- To: gtk-devel-list gnome org
- Subject: Re: Valgrind and GTK
- Date: Sun, 03 Jan 2010 11:14:08 +0100
On Sat, 2010-01-02 at 14:40 +1100, Erik de Castro Lopo wrote:
> 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:
>
> http://library.gnome.org/devel/gtk-tutorial/stable/c39.html#SEC-HELLOWORLD
>
> when run as follows (suppression file from http://live.gnome.org/Valgrind):
>
> 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 agree that it would help a lot if we could in one way or another get
rid of false positives. But my experience shows that you get pretty much
the same valgrind warnings no matter how large your GTK+ application is.
Your 100 line demo program will produce the same set of warnings as your
30000 lines application (provided that your code doesn't have leaks).
But still it would make everyone's life easier if one wouldn't have to
differentiate between false and real positives manually. Perhaps
valgrind suppression files maintained and shipped with the libraries
would indeed be a good idea.
Sven
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]