diff options
author | Max Kellermann <max@duempel.org> | 2013-01-04 15:30:10 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-01-04 20:48:28 +0100 |
commit | 223b90d0d4e79f74ebafbd0db9aea70a3bf9b74b (patch) | |
tree | dd2cdd5f2b9e41f9c6d861cf270a7d37dc21a07d /src/MusicBuffer.cxx | |
parent | 692b2cfb79b0553fef9bb6bba317a3231a4c0055 (diff) | |
download | mpd-223b90d0d4e79f74ebafbd0db9aea70a3bf9b74b.tar.gz mpd-223b90d0d4e79f74ebafbd0db9aea70a3bf9b74b.tar.xz mpd-223b90d0d4e79f74ebafbd0db9aea70a3bf9b74b.zip |
MusicBuffer: return memory to kernel when stopping playback
Use the new HugeAllocator as backend for SliceBuffer and call
HugeDiscard() when the last chunk was returned.
Diffstat (limited to '')
-rw-r--r-- | src/MusicBuffer.cxx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/MusicBuffer.cxx b/src/MusicBuffer.cxx index ec6e52054..5fddddc22 100644 --- a/src/MusicBuffer.cxx +++ b/src/MusicBuffer.cxx @@ -21,6 +21,7 @@ #include "MusicBuffer.hxx" #include "MusicChunk.hxx" #include "util/SliceBuffer.hxx" +#include "mpd_error.h" #include <glib.h> @@ -32,7 +33,10 @@ struct music_buffer : public SliceBuffer<music_chunk> { music_buffer(unsigned num_chunks) :SliceBuffer(num_chunks), - mutex(g_mutex_new()) {} + mutex(g_mutex_new()) { + if (IsOOM()) + MPD_ERROR("Failed to allocate buffer"); + } ~music_buffer() { g_mutex_free(mutex); |