summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pulsecore/core.c11
-rw-r--r--src/pulsecore/core.h2
-rw-r--r--src/pulsecore/sink-input.c2
-rw-r--r--src/pulsecore/source-output.c2
4 files changed, 17 insertions, 0 deletions
diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c
index eef967a6..c064e67e 100644
--- a/src/pulsecore/core.c
+++ b/src/pulsecore/core.c
@@ -250,3 +250,14 @@ int pa_core_exit(pa_core *c, pa_bool_t force, int retval) {
c->mainloop->quit(c->mainloop, retval);
return 0;
}
+
+void pa_core_maybe_vacuum(pa_core *c) {
+ pa_assert(c);
+
+ if (!pa_idxset_isempty(c->sink_inputs) ||
+ !pa_idxset_isempty(c->source_outputs))
+ return;
+
+ pa_log_debug("Hmm, no streams around, trying to vacuum.");
+ pa_mempool_vacuum(c->mempool);
+}
diff --git a/src/pulsecore/core.h b/src/pulsecore/core.h
index 7660bd3b..093fa8f7 100644
--- a/src/pulsecore/core.h
+++ b/src/pulsecore/core.h
@@ -171,4 +171,6 @@ void pa_core_check_idle(pa_core *c);
int pa_core_exit(pa_core *c, pa_bool_t force, int retval);
+void pa_core_maybe_vacuum(pa_core *c);
+
#endif
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index 544bb339..34de9bb3 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -468,6 +468,8 @@ void pa_sink_input_unlink(pa_sink_input *i) {
i->sink = NULL;
}
+ pa_core_maybe_vacuum(i->core);
+
pa_sink_input_unref(i);
}
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index d8a2363c..d99f79c5 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -335,6 +335,8 @@ void pa_source_output_unlink(pa_source_output*o) {
o->source = NULL;
}
+ pa_core_maybe_vacuum(o->core);
+
pa_source_output_unref(o);
}