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.
This commit is contained in:
Max Kellermann 2010-05-19 23:29:13 +02:00
parent 9aeed06964
commit ed0b48040c
1 changed files with 2 additions and 2 deletions

View File

@ -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);
}