Re: Valgrind is grinding my gears



Setting the env var G_SLICE=always-malloc helps a lot (at least from my experience).

Also have a look at https://wiki.gnome.org/Valgrind for more stuff like suppression files for various applications, maybe you can derive your own from one of those.

If you want to really want get into the nitty gritty details, there is no way around the valgrind/memcheck manual.

Best

Bernhard

On Tue, Nov 5, 2013 at 7:15 PM, David Buchan <pdbuchan yahoo com> wrote:
Sorry for peppering you with emails but I just noticed this statement:

"For newly written code it is recommended
to use the new g_slice API instead of g_malloc() and
friends, as long as objects are not resized during their lifetime and the object size used at allocation time is still available when freeing" - https://developer.gnome.org/glib/unstable/glib-Memory-Slices.html

I do indeed change dimensions of arrays declared within my struct (a lot, in fact). Could this be the cause?


________________________________
 From: David Buchan <pdbuchan yahoo com>
To: gtk-app-devel-list list <gtk-app-devel-list gnome org> Sent: Tuesday, November 5, 2013 1:09 PM
Subject: Re: Valgrind is grinding my gears

Perhaps relevant, is that I have a large struct which I use to pass stuff amongst functions and callbacks and I allocate memory for it in main() thus:

  // Allocate data structure
  data = g_slice_new (MyData);

and then free it at the end:

  g_slice_free (MyData, data);

Maybe Valgrind has trouble with g-sliced memory?



________________________________
 From: David Buchan <pdbuchan yahoo com>
To: gtk-app-devel-list list <gtk-app-devel-list gnome org> Sent: Tuesday, November 5, 2013 12:47 PM
Subject: Valgrind is grinding my gears
I have a rather large program I've written in C language which uses GTK+2. My Makefile has:

CCFLAGS = `pkg-config --cflags gtk+-2.0 gmodule-2.0`
LIBS    = `pkg-config --libs   gtk+-2.0 gmodule-2.0`

GCC compiles it without warnings using flags:

-Wall -O -Wuninitialized

My program has several user interface files prepared using
 Glade.

I use the program quite a bit and have no stability issues.

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?


Dave
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
_______________________________________________
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]