On 09/27/2017 11:06 PM, Ion GaztaƱaga via Boost wrote:
Usually the choice is usually between a factor of 2 and 1.5. The theoretical limit value for the growth factor to be able to reuse previously allocated memory is roughly 1.61. Howard Hinnant shared with
There are several factors in play, so we may need a slightly more sophisticated growth policy. Besides memory coalescing, there is also the performance concern about the average number of memory reallocation per added byte. When the capacity is low we may want to grow more aggressively, because the reallocation-per-byte concern outweighs the coalescing concern. As the capacity increases the coalescing concern will become more important and we would want to adjust the growth factor below the golden ratio.