diff options
author | Max Kellermann <max@duempel.org> | 2010-05-19 23:29:13 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2010-05-20 09:31:51 +0200 |
commit | ed0b48040c41d2080e4abaa311a158d7115ef842 (patch) | |
tree | bce2fb0f22a83e1d57bbea39e4a79a9d3bb34a23 | |
parent | 9aeed069641d69d69290a802f3626d2e6d804abc (diff) | |
download | mpd-ed0b48040c41d2080e4abaa311a158d7115ef842.tar.gz mpd-ed0b48040c41d2080e4abaa311a158d7115ef842.tar.xz mpd-ed0b48040c41d2080e4abaa311a158d7115ef842.zip |
pcm_buffer: 8 kB alignment instead of 64 kB
Reduce the overhead. Most buffers used by MPD are around 2 to 4 kB.
8 kB seems large enough to keep heap fragmentation low.
Additionally, this patch fixes an off-by-one error in the alignment
formula.
-rw-r--r-- | src/pcm_buffer.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pcm_buffer.h b/src/pcm_buffer.h index 0046b7470..626851990 100644 --- a/src/pcm_buffer.h +++ b/src/pcm_buffer.h @@ -65,8 +65,8 @@ pcm_buffer_get(struct pcm_buffer *buffer, size_t size) /* free the old buffer */ g_free(buffer->buffer); - /* allocate a new buffer; align at 64kB boundaries */ - buffer->size = (size | 0xffff) + 1; + /* allocate a new buffer; align at 8 kB boundaries */ + buffer->size = ((size - 1) | 0x1fff) + 1; buffer->buffer = g_malloc(buffer->size); } |