Commit ed0b4804 authored by Max Kellermann's avatar Max Kellermann

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.
parent 9aeed069
...@@ -65,8 +65,8 @@ pcm_buffer_get(struct pcm_buffer *buffer, size_t size) ...@@ -65,8 +65,8 @@ pcm_buffer_get(struct pcm_buffer *buffer, size_t size)
/* free the old buffer */ /* free the old buffer */
g_free(buffer->buffer); g_free(buffer->buffer);
/* allocate a new buffer; align at 64kB boundaries */ /* allocate a new buffer; align at 8 kB boundaries */
buffer->size = (size | 0xffff) + 1; buffer->size = ((size - 1) | 0x1fff) + 1;
buffer->buffer = g_malloc(buffer->size); buffer->buffer = g_malloc(buffer->size);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment