I’ve run into a slight problem when running a glib application in valgrind (using
MALLOC_CHECK_=2 but I’m not sure whether they make a difference). I get a lot of false “Invalid read” error reports from valgrind. The reads are all within bounds of blocks that haven’t been freed, so I guess it thinks the memory being read hasn’t been initialised. The errors all seem to be when trying to read from an object’s instance struct. They come from GObject’s own code too, not just mine.
The GObject construction process explicitly initialises such structs (and objects’ private data structs, I think) to 0, so these reads shouldn’t be a problem. So why is valgrind not picking up on that?