| 1 |
Running D-Bus clients with Valgrind |
| 2 |
==== |
| 3 |
|
| 4 |
When running programs using libdbus in Valgrind, some special care needs to be |
| 5 |
taken so as to avoid incorrect detection of leaks in libdbus. To avoid these |
| 6 |
false positives, do the following: |
| 7 |
|
| 8 |
* Grab a copy of the D-Bus source code |
| 9 |
|
| 10 |
* Run configure with the --enable-developer and --with-valgrind options |
| 11 |
|
| 12 |
* Run make |
| 13 |
|
| 14 |
* Either make sure your code calls dbus_shutdown() (at least while running in |
| 15 |
Valgrind) or set DBUS_MESSAGE_CACHE=0 in your environment |
| 16 |
|
| 17 |
* Run Valgrind on your program with the /path/to/dbus/source/dbus/.libs in your |
| 18 |
LD_LIBRARY_PATH |
| 19 |
|
| 20 |
Your Valgrind log should now be free of any (spurious) libdbus-related leaks. |
| 21 |
|
| 22 |
For the curious, the DBUS_MESSAGE_CACHE=0 is required because by |
| 23 |
default, libdbus uses a recyclable pool of message structs. These help |
| 24 |
performance a bit. |