Because /usr/bin/X is normally not started directly by the user, and is also setuid root, running it under valgrind for debugging purposes requires some additonal adjustments. Here's a recipe for running your X server under valgrind that might be helpful.
Note: valgrind is a tool for debugging memory allocation bugs. As a result, running a program under valgrind substantially increases the cost of all memory operations. This will make your X server use more memory and run very slowly. You probably don't want to run X under valgrind unless you are specifically trying to debug a memory corruption error!
If you are starting valgrind from a display manager (such as gdm), the following recipe should be sufficient:
$ sudo dpkg-divert --local --rename --divert /usr/bin/X.valgrind-testing /usr/bin/X $ sudo tee /usr/bin/X #!/bin/sh exec valgrind --error-limit=no --log-file=/var/log/Xorg-valgrind.log /usr/bin/X.valgrind-testing "$@" ^D $ sudo chmod a+x /usr/bin/X $ sudo chmod ug-s /usr/bin/X.valgrind-testing $
To unwind, run:
$ sudo rm /usr/bin/X $ sudo chmod ug+s /usr/bin/X.valgrind-testing $ sudo dpkg-divert --remove --local --rename /usr/bin/X $