Added an option to only produce a new buffer when resizing to a different size.