On 3 Jan 2015, at 21:15, Sean Nakasone <seannakas...@yahoo.com> wrote:
> 
> Hi, lib/obstack.c has a function, _obstack_newchunk(). 
> 
> there's a formula used to calculate a variable new_size
> 
> new_size = (obj_size + length) + (obj_size >> 3) + h->alignment_mask + 100;
> 
> i understand obj_size + length, but what's the other stuff for?

Perhaps some reallocation policy, avoiding too many reallocations. On a C++ 
class std::vector, one might double the allocations, and half if it gets down 
below a quarter: some hysteresis, to avoid border cases producing a lot of 
reallocations.



_______________________________________________
help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to