add estimate_size that is used for preallocating the buffer