summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2015-03-12 13:42:46 +0100
committerDavid Henningsson <david.henningsson@canonical.com>2015-03-12 13:42:46 +0100
commitb8bcfeb78d2be05cd1f441f292c808c7c4f4abc2 (patch)
tree1901a9f1f7bf8f3fa27b1fca14295c7c49647b68
parenta13b6f001d0ef00f540ddf02f54915cda76109bd (diff)
core-util: Fix set_nice() to use private bus connections
In src/pulsecore/core-util.c:set_nice() we currently use a temporary dbus-connection to set the nice-level via rtkit. However, we never close that connection. This is fine, as the connection is shared and dbus-core will manage it. But no other part of pulseaudio (except set_scheduler()) uses the libdbus1 managed connections. Therefore, we effectively end up with an unused dbus-connection that is not integrated into any main-loop. dbus-daemon will send bus-notifications to the connection (as libdbus1 installs matches for those by default (it has to!)) until the outgoing queue is full. Thus, we waste several KBs (or MBs? I didn't look it up) of memory for a message queue that is never dispatched. Signed-off-by: David Henningsson <david.henningsson@canonical.com>
-rw-r--r--src/pulsecore/core-util.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index 9b16936c9..b37e450ca 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -860,7 +860,7 @@ static int set_nice(int nice_level) {
#ifdef HAVE_DBUS
/* Try to talk to RealtimeKit */
- if (!(bus = dbus_bus_get(DBUS_BUS_SYSTEM, &error))) {
+ if (!(bus = dbus_bus_get_private(DBUS_BUS_SYSTEM, &error))) {
pa_log("Failed to connect to system bus: %s\n", error.message);
dbus_error_free(&error);
errno = -EIO;
@@ -873,6 +873,7 @@ static int set_nice(int nice_level) {
dbus_connection_set_exit_on_disconnect(bus, FALSE);
r = rtkit_make_high_priority(bus, 0, nice_level);
+ dbus_connection_close(bus);
dbus_connection_unref(bus);
if (r >= 0) {