Re: Valgrind is grinding my gears



No, as soon as you use GObject derived types (or call g_types_init/gtk_init) the class structures for all your gobject derived classes will be created _once_. This unevitable, but nothing to worry about (same for GThread and friends), just be aware of their existance (and/or suppress them in the valgrind output).

This has nothing to do with G_SLICE=always-malloc, it actually just reduces the false-positives of valgrind as g_malloc internally allocates big chunks of memory and feeds them as chunks to g_malloc calls, which in turn valgrind sometimes counts as "possibly lost" and clutters the output.

Bernhard

On Tue, Nov 5, 2013 at 9:54 PM, David Buchan <pdbuchan yahoo com> wrote:
Hi Dave,

"GObject type registration machinery is, under normal circumstances, only ever used tocreate structures that will exist during the entire program lifetime."

Does that mean that if I just use straight old malloc() instead of g_slice(), most of the errors would go away? I gather that's essentially what using G_SLICE=always-malloc would do.


I can't try this out until late tonight, unfortunately.


________________________________
 From: David Nečas <yeti physics muni cz>
To: David Buchan <pdbuchan yahoo com> Cc: gtk-app-devel-list list <gtk-app-devel-list gnome org> Sent: Tuesday, November 5, 2013 2:51 PM
Subject: Re: Valgrind is grinding my gears
On Tue, Nov 05, 2013 at 09:47:13AM -0800, David Buchan wrote:

 But when I invoke Valgrind at runtime, I get a lot of errors which I
 can't make any sense of.
I have grabbed a small sample of them here: http://pdbuchan.com/valgrind.txt I don't like ignoring errors and warnings, but I don't know what to do
 with these.
Has anybody else come across these types of Valgrind notifications?

Yes, everyone.  You must understand that all the GObject type
registration machinery is, under normal circumstances, only ever used to
create structures that will exist during the entire program lifetime.
So although things such as class reference leaks can exists, eveything
inside g_type_class_ref() should be ignorable – and you can clearly see
from the log that these allocations happen once, not a thousand times.
The same for g_thread_init(), gtk_init(), etc.  Create a suppression
file or google one...

Regards,

Yeti
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


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