[zeromq-dev] Memory management
Martin Sustrik
sustrik at fastmq.com
Fri May 15 10:09:51 CEST 2009
Hi Steven,
> The slab allocates blocks of memory aligned as preferred by the
> underlying architecture. Using a ring buffer and arbritarily
> slicing up blocks can make paging worse as multiple requests
> might be needed for one buffer. One solution is to implement a
> hybrid design that allocates page size and alignment friendly
> blocks of memory.
>
> wide stack.png
>
>
> This could still be implemented in a stack or a ring buffer,
> reference counting can be used for individual slices of a chunk.
>
> Page Cache Friendly.
>
> Sorry, I'm lost here. What do you mean by "multiple requests might
> be needed for one buffer"?
>
>
>
> If you have an 4KB page and a 4KB object but 1KB is in one page, 3KB in
> the next page, you end up with twice the overhead of when the object
> neatly fits in one page.
Ok, I see. However, if tx/rx are stored in a single preallocated chunk
of memory, it ceases to be a problem as all the memory allocation is
done in advance, no?
Martin
More information about the zeromq-dev
mailing list