Documentation inaccurately states that buffer is resized; buffer must be preallocated before the call to at least the specified size.