reallocates buffers where possible