mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-11 13:30:02 -05:00
pulsecore: Reference count mempools
In future commits, server-wide SHMs will be replaced with per-client ones that will be dynamically created and freed according to clients connections open and close. Meanwhile, current PA design does not guarantee that the per-client mempool blocks are referenced only by client-specific objects. Thus reference count the pools and let each memblock inside the pool itself, or just attached to it, increment the pool's refcount upon allocation. This way, per-client mempools will only be freed when no further component in the system holds any references to its blocks. DiscussionLink: https://goo.gl/qesVMV Suggested-by: Tanu Kaskinen <tanuk@iki.fi> Suggested-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
This commit is contained in:
parent
1f5e72264e
commit
9bda6e344a
17 changed files with 84 additions and 20 deletions
|
|
@ -142,7 +142,7 @@ static void run_mix_test(
|
|||
pa_memblock_unref(c0.memblock);
|
||||
pa_memblock_unref(c1.memblock);
|
||||
|
||||
pa_mempool_free(pool);
|
||||
pa_mempool_unref(pool);
|
||||
}
|
||||
|
||||
START_TEST (mix_special_test) {
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ START_TEST (lfe_filter_test) {
|
|||
|
||||
pa_lfe_filter_free(lft.lf);
|
||||
|
||||
pa_mempool_free(lft.pool);
|
||||
pa_mempool_unref(lft.pool);
|
||||
|
||||
if (!ret)
|
||||
pa_log_debug("lfe-filter-test: tests for both rewind to block boundary and rewind to middle position of a block passed!");
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ int main(int argc, char *argv[]) {
|
|||
if (c.memblock)
|
||||
pa_memblock_unref(c.memblock);
|
||||
|
||||
pa_mempool_free(p);
|
||||
pa_mempool_unref(p);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -169,9 +169,9 @@ START_TEST (memblock_test) {
|
|||
|
||||
pa_log("vacuuming done...");
|
||||
|
||||
pa_mempool_free(pool_a);
|
||||
pa_mempool_free(pool_b);
|
||||
pa_mempool_free(pool_c);
|
||||
pa_mempool_unref(pool_a);
|
||||
pa_mempool_unref(pool_b);
|
||||
pa_mempool_unref(pool_c);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ START_TEST (memblockq_test) {
|
|||
pa_memblock_unref(chunk3.memblock);
|
||||
pa_memblock_unref(chunk4.memblock);
|
||||
|
||||
pa_mempool_free(p);
|
||||
pa_mempool_unref(p);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
|
|
|||
|
|
@ -338,7 +338,7 @@ START_TEST (mix_test) {
|
|||
pa_memblock_unref(k.memblock);
|
||||
}
|
||||
|
||||
pa_mempool_free(pool);
|
||||
pa_mempool_unref(pool);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ int main(int argc, char *argv[]) {
|
|||
pa_resampler_free(r);
|
||||
}
|
||||
|
||||
pa_mempool_free(pool);
|
||||
pa_mempool_unref(pool);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -473,7 +473,7 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
quit:
|
||||
if (pool)
|
||||
pa_mempool_free(pool);
|
||||
pa_mempool_unref(pool);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ START_TEST (srbchannel_test) {
|
|||
|
||||
pa_pstream_unref(p1);
|
||||
pa_pstream_unref(p2);
|
||||
pa_mempool_free(mp);
|
||||
pa_mempool_unref(mp);
|
||||
pa_mainloop_free(ml);
|
||||
}
|
||||
END_TEST
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue