[pulseaudio-commits] src/pulsecore
David Henningsson
diwic at kemper.freedesktop.org
Thu Mar 12 05:45:01 PDT 2015
src/pulsecore/core-util.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
New commits:
commit b8bcfeb78d2be05cd1f441f292c808c7c4f4abc2
Author: David Herrmann <dh.herrmann at gmail.com>
Date: Thu Mar 12 13:42:46 2015 +0100
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 at canonical.com>
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index 9b16936..b37e450 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) {
More information about the pulseaudio-commits
mailing list