How to free ressources allocated by dbus_bus_get ?
hp at redhat.com
Tue Nov 7 08:27:14 PST 2006
> I was wondering how memory ressources claimed by 'dbus_bus_get' should be released.
> I used 'dbus_connection_unref' and 'dbus_connection_close' calls, but memory leaks are always present.
dbus_bus_get() opens a shared connection, which means dbus saves it and
will return it again to other callers of bus_get/connection_open who ask
for the same bus.
You have to unref() the connection, but are not allowed to close it.
(see API docs)
If you want to free shared connections you can call dbus_shutdown() just
before your app exits. (see API docs on dbus_shutdown()) However,
running valgrind with --show-reachable=no is just as good probably.
More information about the dbus