Skip to content
Commit 00fbc2f0 authored by Allison Karlitskaya's avatar Allison Karlitskaya
Browse files

gslice: disable by default under valgrind

All experienced GLib hackers know that G_SLICE=always-malloc is
absolutely essential when valgrinding but many users of GLib don't know
about this and get hit pretty hard when valgrinding their programs.

When initialising gslice, add a check to see if we are running under
valgrind and disable ourselves if we are.

We only do the check in the case that G_SLICE= was not specified in the
environment, so setting it to an empty string will prevent this default
behaviour.

I considered modifying gslice to use the VALGRIND_MALLOCLIKE_BLOCK
client request in all cases in order to just mark the blocks properly
but these calls are not free and gslice is pretty hyper-optimised.  It's
easier to just disable gslice completely and this way we only have to do
one check during startup.  It's also theoretically possible that someone
might want to use valgrind to debug gslice, in which case the extra
annotations would probably cause quite a lot of difficulty.

https://bugzilla.gnome.org/show_bug.cgi?id=698595
parent c8d56d7c
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment