On 21/02/12 13:31 -0700, Steven Dake wrote:
Angus,
I have found that loop_poll uses qb_array_create() (which does not
autogrow). Wouldn't this result in a ERANGE error on index for the poll
array?
Sure, but it calls qb_array_grow() so that is not a problem.
I also noticed a full bin size is allocated. This makes sense (don't
want to realloc this array) but 256 elements (MAX_BIN_ELEMENTS) * a
large element size (such as 1k = very large memory consumption.
I agree the MAX_BIN_ELEMENTS is quite high.
Seems like there is a determinism tradeoff between MAX_BIN and autogrow.
Are there other considerations?
One thing I want to add is to allow holes in the array (so don't alloc
unneeded bins.
I'd prefer lower memory usage for something like the loop_poll operation.
That would be good.
What are you thoughts about the tradeoff here (ie: do you have a strong
preference)?
One thing I also noticed was that the bin array was hard specified.
This makes sense if bin is small (256) but a reallocing bin would make
more sense if BIN_MAX was increased to something larger (like 2048 bin
elements).
The main purpose of the array is to replace realloc style arrays
so you can hold references to memory and be guarenteed it won't move
about.
I think we can improve by doing a couple of things:
- make the MAX_BIN_ELEMENTS smaller.
- dynamically allocate the bin array (array of pointers used
internally) and realloc as needed.
- don't alloc bins that aren't needed.
I'll post a patch soon and you can see if it helps.
-Angus
_______________________________________________
quarterback-devel mailing list
quarterback-devel(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/quarterback-devel