reworked buffer reallocation strategy, inspired by FBVector