I have a question regarding the boost::pool implementation.
Why does boost::pool::alloc_size() have to be lcm(sizeof(void*), sizeof(size_type), requested_size)?
I have read the "Guaranteeing Alignment" document (http://www.boost.org/libs/pool/doc/implementation/alignment.html), and looking at the code I can see that a lot of bytes can be wasted in the chunks returned to user when requested_size is not a multiple of min_alloc_size (lcm(sizeof(void*), sizeof(size_type))).
I would think the requested_size alignment could be the first multiple of min_alloc_size that is larger than requested_size. For example, the convoluted example has requested_size==7, sizeof(void*)==3, and sizeof(size_type)==5. Currently alloc_size() returns lcm(3,5,7)==105, but since min_alloc_size is lcm(3,5)==15, I would think requested_size alignment could be 15 bytes, rather than the 105 bytes.
The Theorem in the document is still satisfied. "For each integer i, such that pe+i is well defined, that address (pe+i) is properly aligned for each type Tn."
Another way to look at this. If requested_size was changed to 15, then the current implementation of alloc_size() would return 15 bytes (lcm(3,5,15)==15), so why the huge penalty when requested size is 7?
I am probably missing something?