It would be nice if webkit would auto-disable gigacage when it detects that valgrind is running. Otherwise, everyone who uses libwebkit2gtk-4.0 has to track down how to disable it with GIGACAGE_ENABLED=0 to use valgrind.
The easy way to go about this would be detecting whether <valgrind.h> is available, and use the “RUNNING_ON_VALGRIND” macro defined by it: http://valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.clientreq Note that it expands to inline assembler in the architectures supported by Valgrind, so it would be a build-time dependency only. It would be nicer to not need Valgrind for building, but other alternative I see around is checking “/proc/self/smaps” and grep for the name of the Valgrind shared library which gets LD_PRELOAD'ed and that looks flimsy to me.