How to free ressources allocated by dbus_bus_get ?
Havoc Pennington
hp at redhat.com
Tue Nov 7 08:27:14 PST 2006
10function wrote:
>
> 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.
Havoc
More information about the dbus
mailing list